home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 2 / Amiga Tools 2.iso / tex / macros / source / contrib / calc / calc.dtx next >
LaTeX Document  |  1995-03-10  |  32.3 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: LaTeX Document (document/latex).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert LaTeX Document (document/latex) magic Supported
1% dexvert Text File (text/txt) fallback Supported
100% file LaTeX 2e document text default
99% file LaTeX document text default
98% file LaTeX document, ASCII text default
100% TrID LaTeX 2e document (with rem) default
100% checkBytes Printable ASCII default
100% perlTextCheck Likely Text (Perl) default
100% detectItEasy Format: plain text[LF] default (weak)



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 25 20 5c 69 66 66 61 6c | 73 65 0a 25 0a 25 25 20 |% \iffal|se.%.%% |
|00000010| 46 69 6c 65 20 60 63 61 | 6c 63 2e 64 74 78 27 2e |File `ca|lc.dtx'.|
|00000020| 0a 25 25 20 43 6f 70 79 | 72 69 67 68 74 20 28 43 |.%% Copy|right (C|
|00000030| 29 20 31 39 39 32 2d 2d | 31 39 39 34 20 4b 72 65 |) 1992--|1994 Kre|
|00000040| 73 74 65 6e 20 4b 72 61 | 62 20 54 68 6f 72 75 70 |sten Kra|b Thorup|
|00000050| 20 61 6e 64 20 46 72 61 | 6e 6b 20 4a 65 6e 73 65 | and Fra|nk Jense|
|00000060| 6e 2e 0a 25 25 20 41 6c | 6c 20 72 69 67 68 74 73 |n..%% Al|l rights|
|00000070| 20 72 65 73 65 72 76 65 | 64 2e 0a 25 0a 25 20 50 | reserve|d..%.% P|
|00000080| 6c 65 61 73 65 20 73 65 | 6e 64 20 65 72 72 6f 72 |lease se|nd error|
|00000090| 20 72 65 70 6f 72 74 73 | 20 61 6e 64 20 73 75 67 | reports| and sug|
|000000a0| 67 65 73 74 69 6f 6e 73 | 20 66 6f 72 20 69 6d 70 |gestions| for imp|
|000000b0| 72 6f 76 65 6d 65 6e 74 | 73 20 74 6f 3a 0a 25 0a |rovement|s to:.%.|
|000000c0| 25 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |% | |
|000000d0| 20 20 20 20 20 20 20 20 | 20 20 20 46 72 61 6e 6b | | Frank|
|000000e0| 20 4a 65 6e 73 65 6e 0a | 25 20 20 20 20 20 20 20 | Jensen.|% |
|000000f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000100| 20 20 20 41 61 6c 62 6f | 72 67 20 55 6e 69 76 65 | Aalbo|rg Unive|
|00000110| 72 73 69 74 79 0a 25 20 | 20 20 20 20 20 20 20 20 |rsity.% | |
|00000120| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000130| 20 44 4b 2d 39 32 32 30 | 20 41 61 6c 62 6f 72 67 | DK-9220| Aalborg|
|00000140| 20 5c 4f 0a 25 20 20 20 | 20 20 20 20 20 20 20 20 | \O.% | |
|00000150| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 44 | | D|
|00000160| 65 6e 6d 61 72 6b 0a 25 | 20 20 20 20 20 20 20 20 |enmark.%| |
|00000170| 20 20 20 20 20 20 20 49 | 6e 74 65 72 6e 65 74 3a | I|nternet:|
|00000180| 20 20 3c 66 6a 40 69 65 | 73 64 2e 61 75 63 2e 64 | <fj@ie|sd.auc.d|
|00000190| 6b 3e 0a 25 20 6f 72 0a | 25 20 20 20 20 20 20 20 |k>.% or.|% |
|000001a0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000001b0| 20 20 20 4e 65 58 54 20 | 43 6f 6d 70 75 74 65 72 | NeXT |Computer|
|000001c0| 2c 20 49 6e 63 2e 0a 25 | 20 20 20 20 20 20 20 20 |, Inc..%| |
|000001d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000001e0| 20 20 41 74 74 6e 2e 3a | 20 4b 72 65 73 74 65 6e | Attn.:| Kresten|
|000001f0| 20 4b 72 61 62 20 54 68 | 6f 72 75 70 0a 25 20 20 | Krab Th|orup.% |
|00000200| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000210| 20 20 20 20 20 20 20 20 | 39 30 30 20 43 68 65 73 | |900 Ches|
|00000220| 61 70 65 61 6b 65 20 44 | 72 69 76 65 0a 25 20 20 |apeake D|rive.% |
|00000230| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000240| 20 20 20 20 20 20 20 20 | 52 65 64 77 6f 6f 64 20 | |Redwood |
|00000250| 43 69 74 79 2c 20 43 41 | 20 39 34 30 36 33 0a 25 |City, CA| 94063.%|
|00000260| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00000270| 20 20 20 20 20 20 20 20 | 20 20 55 53 41 0a 25 20 | | USA.% |
|00000280| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 49 6e | | In|
|00000290| 74 65 72 6e 65 74 3a 20 | 20 3c 6b 72 61 62 40 6e |ternet: | <krab@n|
|000002a0| 65 78 74 2e 63 6f 6d 3e | 0a 25 0a 25 20 5c 66 69 |ext.com>|.%.% \fi|
|000002b0| 0a 0a 5c 64 65 66 5c 66 | 69 6c 65 76 65 72 73 69 |..\def\f|ileversi|
|000002c0| 6f 6e 7b 76 34 2e 30 62 | 20 28 54 45 53 54 29 7d |on{v4.0b| (TEST)}|
|000002d0| 0a 5c 64 65 66 5c 66 69 | 6c 65 64 61 74 65 7b 39 |.\def\fi|ledate{9|
|000002e0| 35 2f 30 32 2f 30 39 7d | 0a 0a 25 20 5c 43 68 65 |5/02/09}|..% \Che|
|000002f0| 63 6b 53 75 6d 7b 33 36 | 39 7d 0a 25 25 20 5c 43 |ckSum{36|9}.%% \C|
|00000300| 68 61 72 61 63 74 65 72 | 54 61 62 6c 65 0a 25 25 |haracter|Table.%%|
|00000310| 20 20 7b 55 70 70 65 72 | 2d 63 61 73 65 20 20 20 | {Upper|-case |
|00000320| 20 5c 41 5c 42 5c 43 5c | 44 5c 45 5c 46 5c 47 5c | \A\B\C\|D\E\F\G\|
|00000330| 48 5c 49 5c 4a 5c 4b 5c | 4c 5c 4d 5c 4e 5c 4f 5c |H\I\J\K\|L\M\N\O\|
|00000340| 50 5c 51 5c 52 5c 53 5c | 54 5c 55 5c 56 5c 57 5c |P\Q\R\S\|T\U\V\W\|
|00000350| 58 5c 59 5c 5a 0a 25 25 | 20 20 20 4c 6f 77 65 72 |X\Y\Z.%%| Lower|
|00000360| 2d 63 61 73 65 20 20 20 | 20 5c 61 5c 62 5c 63 5c |-case | \a\b\c\|
|00000370| 64 5c 65 5c 66 5c 67 5c | 68 5c 69 5c 6a 5c 6b 5c |d\e\f\g\|h\i\j\k\|
|00000380| 6c 5c 6d 5c 6e 5c 6f 5c | 70 5c 71 5c 72 5c 73 5c |l\m\n\o\|p\q\r\s\|
|00000390| 74 5c 75 5c 76 5c 77 5c | 78 5c 79 5c 7a 0a 25 25 |t\u\v\w\|x\y\z.%%|
|000003a0| 20 20 20 44 69 67 69 74 | 73 20 20 20 20 20 20 20 | Digit|s |
|000003b0| 20 5c 30 5c 31 5c 32 5c | 33 5c 34 5c 35 5c 36 5c | \0\1\2\|3\4\5\6\|
|000003c0| 37 5c 38 5c 39 0a 25 25 | 20 20 20 45 78 63 6c 61 |7\8\9.%%| Excla|
|000003d0| 6d 61 74 69 6f 6e 20 20 | 20 5c 21 20 20 20 20 20 |mation | \! |
|000003e0| 44 6f 75 62 6c 65 20 71 | 75 6f 74 65 20 20 5c 22 |Double q|uote \"|
|000003f0| 20 20 20 20 20 48 61 73 | 68 20 28 6e 75 6d 62 65 | Has|h (numbe|
|00000400| 72 29 20 5c 23 0a 25 25 | 20 20 20 44 6f 6c 6c 61 |r) \#.%%| Dolla|
|00000410| 72 20 20 20 20 20 20 20 | 20 5c 24 20 20 20 20 20 |r | \$ |
|00000420| 50 65 72 63 65 6e 74 20 | 20 20 20 20 20 20 5c 25 |Percent | \%|
|00000430| 20 20 20 20 20 41 6d 70 | 65 72 73 61 6e 64 20 20 | Amp|ersand |
|00000440| 20 20 20 5c 26 0a 25 25 | 20 20 20 41 63 75 74 65 | \&.%%| Acute|
|00000450| 20 61 63 63 65 6e 74 20 | 20 5c 27 20 20 20 20 20 | accent | \' |
|00000460| 4c 65 66 74 20 70 61 72 | 65 6e 20 20 20 20 5c 28 |Left par|en \(|
|00000470| 20 20 20 20 20 52 69 67 | 68 74 20 70 61 72 65 6e | Rig|ht paren|
|00000480| 20 20 20 5c 29 0a 25 25 | 20 20 20 41 73 74 65 72 | \).%%| Aster|
|00000490| 69 73 6b 20 20 20 20 20 | 20 5c 2a 20 20 20 20 20 |isk | \* |
|000004a0| 50 6c 75 73 20 20 20 20 | 20 20 20 20 20 20 5c 2b |Plus | \+|
|000004b0| 20 20 20 20 20 43 6f 6d | 6d 61 20 20 20 20 20 20 | Com|ma |
|000004c0| 20 20 20 5c 2c 0a 25 25 | 20 20 20 4d 69 6e 75 73 | \,.%%| Minus|
|000004d0| 20 20 20 20 20 20 20 20 | 20 5c 2d 20 20 20 20 20 | | \- |
|000004e0| 50 6f 69 6e 74 20 20 20 | 20 20 20 20 20 20 5c 2e |Point | \.|
|000004f0| 20 20 20 20 20 53 6f 6c | 69 64 75 73 20 20 20 20 | Sol|idus |
|00000500| 20 20 20 5c 2f 0a 25 25 | 20 20 20 43 6f 6c 6f 6e | \/.%%| Colon|
|00000510| 20 20 20 20 20 20 20 20 | 20 5c 3a 20 20 20 20 20 | | \: |
|00000520| 53 65 6d 69 63 6f 6c 6f | 6e 20 20 20 20 20 5c 3b |Semicolo|n \;|
|00000530| 20 20 20 20 20 4c 65 73 | 73 20 74 68 61 6e 20 20 | Les|s than |
|00000540| 20 20 20 5c 3c 0a 25 25 | 20 20 20 45 71 75 61 6c | \<.%%| Equal|
|00000550| 73 20 20 20 20 20 20 20 | 20 5c 3d 20 20 20 20 20 |s | \= |
|00000560| 47 72 65 61 74 65 72 20 | 74 68 61 6e 20 20 5c 3e |Greater |than \>|
|00000570| 20 20 20 20 20 51 75 65 | 73 74 69 6f 6e 20 6d 61 | Que|stion ma|
|00000580| 72 6b 20 5c 3f 0a 25 25 | 20 20 20 43 6f 6d 6d 65 |rk \?.%%| Comme|
|00000590| 72 63 69 61 6c 20 61 74 | 20 5c 40 20 20 20 20 20 |rcial at| \@ |
|000005a0| 4c 65 66 74 20 62 72 61 | 63 6b 65 74 20 20 5c 5b |Left bra|cket \[|
|000005b0| 20 20 20 20 20 42 61 63 | 6b 73 6c 61 73 68 20 20 | Bac|kslash |
|000005c0| 20 20 20 5c 5c 0a 25 25 | 20 20 20 52 69 67 68 74 | \\.%%| Right|
|000005d0| 20 62 72 61 63 6b 65 74 | 20 5c 5d 20 20 20 20 20 | bracket| \] |
|000005e0| 43 69 72 63 75 6d 66 6c | 65 78 20 20 20 20 5c 5e |Circumfl|ex \^|
|000005f0| 20 20 20 20 20 55 6e 64 | 65 72 73 63 6f 72 65 20 | Und|erscore |
|00000600| 20 20 20 5c 5f 0a 25 25 | 20 20 20 47 72 61 76 65 | \_.%%| Grave|
|00000610| 20 61 63 63 65 6e 74 20 | 20 5c 60 20 20 20 20 20 | accent | \` |
|00000620| 4c 65 66 74 20 62 72 61 | 63 65 20 20 20 20 5c 7b |Left bra|ce \{|
|00000630| 20 20 20 20 20 56 65 72 | 74 69 63 61 6c 20 62 61 | Ver|tical ba|
|00000640| 72 20 20 5c 7c 0a 25 25 | 20 20 20 52 69 67 68 74 |r \|.%%| Right|
|00000650| 20 62 72 61 63 65 20 20 | 20 5c 7d 20 20 20 20 20 | brace | \} |
|00000660| 54 69 6c 64 65 20 20 20 | 20 20 20 20 20 20 5c 7e |Tilde | \~|
|00000670| 7d 0a 25 0a 25 20 5c 69 | 66 66 61 6c 73 65 0a 25 |}.%.% \i|ffalse.%|
|00000680| 3c 2a 64 72 69 76 65 72 | 3e 0a 5c 64 6f 63 75 6d |<*driver|>.\docum|
|00000690| 65 6e 74 63 6c 61 73 73 | 7b 6c 74 78 64 6f 63 7d |entclass|{ltxdoc}|
|000006a0| 0a 5c 62 65 67 69 6e 7b | 64 6f 63 75 6d 65 6e 74 |.\begin{|document|
|000006b0| 7d 0a 20 20 20 5c 44 6f | 63 49 6e 70 75 74 7b 63 |}. \Do|cInput{c|
|000006c0| 61 6c 63 2e 64 74 78 7d | 0a 5c 65 6e 64 7b 64 6f |alc.dtx}|.\end{do|
|000006d0| 63 75 6d 65 6e 74 7d 0a | 25 3c 2f 64 72 69 76 65 |cument}.|%</drive|
|000006e0| 72 3e 0a 25 20 5c 66 69 | 0a 25 0a 25 20 5c 74 69 |r>.% \fi|.%.% \ti|
|000006f0| 74 6c 65 7b 54 68 65 20 | 5c 74 65 78 74 74 74 7b |tle{The |\texttt{|
|00000700| 63 61 6c 63 7d 20 70 61 | 63 6b 61 67 65 3a 20 49 |calc} pa|ckage: I|
|00000710| 6e 66 69 78 20 6e 6f 74 | 61 74 69 6f 6e 0a 25 20 |nfix not|ation.% |
|00000720| 20 20 20 20 20 20 20 61 | 72 69 74 68 6d 65 74 69 | a|rithmeti|
|00000730| 63 20 69 6e 20 5c 4c 61 | 54 65 58 5c 74 68 61 6e |c in \La|TeX\than|
|00000740| 6b 73 7b 57 65 20 74 68 | 61 6e 6b 20 46 72 61 6e |ks{We th|ank Fran|
|00000750| 6b 20 4d 69 74 74 65 6c | 62 61 63 68 20 66 6f 72 |k Mittel|bach for|
|00000760| 20 68 69 73 0a 25 20 20 | 20 20 20 20 20 20 76 61 | his.% | va|
|00000770| 6c 75 61 62 6c 65 20 63 | 6f 6d 6d 65 6e 74 73 20 |luable c|omments |
|00000780| 61 6e 64 20 73 75 67 67 | 65 73 74 69 6f 6e 73 20 |and sugg|estions |
|00000790| 77 68 69 63 68 20 68 61 | 76 65 20 67 72 65 61 74 |which ha|ve great|
|000007a0| 6c 79 20 69 6d 70 72 6f | 76 65 64 0a 25 20 20 20 |ly impro|ved.% |
|000007b0| 20 20 20 20 20 74 68 69 | 73 20 70 61 63 6b 61 67 | thi|s packag|
|000007c0| 65 2e 7d 7d 0a 25 20 5c | 61 75 74 68 6f 72 7b 4b |e.}}.% \|author{K|
|000007d0| 72 65 73 74 65 6e 20 4b | 72 61 62 20 54 68 6f 72 |resten K|rab Thor|
|000007e0| 75 70 5c 61 6e 64 20 46 | 72 61 6e 6b 20 4a 65 6e |up\and F|rank Jen|
|000007f0| 73 65 6e 7d 0a 25 20 5c | 64 61 74 65 7b 5c 66 69 |sen}.% \|date{\fi|
|00000800| 6c 65 64 61 74 65 7d 0a | 25 0a 25 20 5c 6d 61 6b |ledate}.|%.% \mak|
|00000810| 65 74 69 74 6c 65 0a 25 | 0a 25 20 5c 6e 65 77 65 |etitle.%|.% \newe|
|00000820| 6e 76 69 72 6f 6e 6d 65 | 6e 74 7b 63 61 6c 63 2d |nvironme|nt{calc-|
|00000830| 73 79 6e 74 61 78 7d 0a | 25 20 20 20 20 7b 5c 70 |syntax}.|% {\p|
|00000840| 61 72 0a 25 20 20 20 20 | 20 5c 70 61 72 73 6b 69 |ar.% | \parski|
|00000850| 70 5c 6d 65 64 73 6b 69 | 70 61 6d 6f 75 6e 74 0a |p\medski|pamount.|
|00000860| 25 20 20 20 20 20 5c 64 | 65 66 5c 69 73 7b 5c 20 |% \d|ef\is{\ |
|00000870| 5c 68 61 6e 67 69 6e 64 | 65 6e 74 33 5c 70 61 72 |\hangind|ent3\par|
|00000880| 69 6e 64 65 6e 74 24 5c | 6c 6f 6e 67 72 69 67 68 |indent$\|longrigh|
|00000890| 74 61 72 72 6f 77 24 7e | 7d 25 0a 25 20 20 20 20 |tarrow$~|}%.% |
|000008a0| 20 5c 64 65 66 5c 61 6c | 74 7b 5c 20 24 5c 76 65 | \def\al|t{\ $\ve|
|000008b0| 72 74 24 7e 7d 25 0a 25 | 20 20 20 20 20 5c 72 69 |rt$~}%.%| \ri|
|000008c0| 67 68 74 73 6b 69 70 20 | 30 70 74 20 70 6c 75 73 |ghtskip |0pt plus|
|000008d0| 20 31 66 69 6c 0a 25 20 | 20 20 20 20 5c 64 65 66 | 1fil.% | \def|
|000008e0| 5c 3c 23 23 31 3e 7b 5c | 6d 62 6f 78 7b 5c 4e 6f |\<##1>{\|mbox{\No|
|000008f0| 72 6d 61 6c 53 70 61 63 | 65 73 24 5c 6c 61 6e 67 |rmalSpac|es$\lang|
|00000900| 6c 65 24 23 23 31 5c 2f | 24 5c 72 61 6e 67 6c 65 |le$##1\/|$\rangle|
|00000910| 24 7d 7d 25 0a 25 20 20 | 20 20 20 5c 49 67 6e 6f |$}}%.% | \Igno|
|00000920| 72 65 53 70 61 63 65 73 | 5c 6f 62 65 79 73 70 61 |reSpaces|\obeyspa|
|00000930| 63 65 73 25 0a 25 20 7d | 7b 5c 70 61 72 5c 76 73 |ces%.% }|{\par\vs|
|00000940| 6b 69 70 5c 70 61 72 73 | 6b 69 70 7d 0a 25 20 7b |kip\pars|kip}.% {|
|00000950| 5c 6f 62 65 79 73 70 61 | 63 65 73 5c 67 64 65 66 |\obeyspa|ces\gdef|
|00000960| 5c 4e 6f 72 6d 61 6c 53 | 70 61 63 65 73 7b 5c 6c |\NormalS|paces{\l|
|00000970| 65 74 20 3d 5c 73 70 61 | 63 65 7d 5c 67 64 65 66 |et =\spa|ce}\gdef|
|00000980| 5c 49 67 6e 6f 72 65 53 | 70 61 63 65 73 7b 5c 64 |\IgnoreS|paces{\d|
|00000990| 65 66 20 7b 7d 7d 7d 0a | 25 0a 25 20 5c 64 65 66 |ef {}}}.|%.% \def|
|000009a0| 5c 3c 23 31 3e 7b 24 5c | 6c 61 6e 67 6c 65 24 23 |\<#1>{$\|langle$#|
|000009b0| 31 5c 2f 24 5c 72 61 6e | 67 6c 65 24 7d 25 0a 25 |1\/$\ran|gle$}%.%|
|000009c0| 20 5c 64 65 66 5c 73 23 | 31 7b 5c 65 6e 73 75 72 | \def\s#|1{\ensur|
|000009d0| 65 6d 61 74 68 7b 5b 5c | 21 5b 23 31 5d 5c 21 5d |emath{[\|![#1]\!]|
|000009e0| 7d 7d 0a 25 20 5c 64 65 | 66 5c 73 61 76 65 63 6f |}}.% \de|f\saveco|
|000009f0| 64 65 23 31 7b 5c 68 62 | 6f 78 7b 24 7b 7d 5f 7b |de#1{\hb|ox{${}_{|
|00000a00| 5c 68 6f 6f 6b 72 69 67 | 68 74 61 72 72 6f 77 5b |\hookrig|htarrow[|
|00000a10| 23 31 5d 7d 24 7d 7d 0a | 25 20 5c 64 65 66 5c 67 |#1]}$}}.|% \def\g|
|00000a20| 61 73 73 69 67 6e 7b 5c | 4c 65 66 74 61 72 72 6f |assign{\|Leftarro|
|00000a30| 77 7d 0a 25 20 5c 64 65 | 66 5c 6c 61 73 73 69 67 |w}.% \de|f\lassig|
|00000a40| 6e 7b 5c 6c 65 66 74 61 | 72 72 6f 77 7d 0a 25 0a |n{\lefta|rrow}.%.|
|00000a50| 25 20 5c 62 65 67 69 6e | 7b 61 62 73 74 72 61 63 |% \begin|{abstrac|
|00000a60| 74 7d 0a 25 20 54 68 65 | 20 5c 74 65 78 74 74 74 |t}.% The| \texttt|
|00000a70| 7b 63 61 6c 63 7d 20 70 | 61 63 6b 61 67 65 20 72 |{calc} p|ackage r|
|00000a80| 65 69 6d 70 6c 65 6d 65 | 6e 74 73 20 74 68 65 20 |eimpleme|nts the |
|00000a90| 5c 4c 61 54 65 58 5c 20 | 63 6f 6d 6d 61 6e 64 73 |\LaTeX\ |commands|
|00000aa0| 0a 25 20 7c 5c 73 65 74 | 63 6f 75 6e 74 65 72 7c |.% |\set|counter||
|00000ab0| 2c 20 7c 5c 61 64 64 74 | 6f 63 6f 75 6e 74 65 72 |, |\addt|ocounter|
|00000ac0| 7c 2c 20 7c 5c 73 65 74 | 6c 65 6e 67 74 68 7c 2c ||, |\set|length|,|
|00000ad0| 20 61 6e 64 20 7c 5c 61 | 64 64 74 6f 6c 65 6e 67 | and |\a|ddtoleng|
|00000ae0| 74 68 7c 2e 0a 25 20 49 | 6e 73 74 65 61 64 20 6f |th|..% I|nstead o|
|00000af0| 66 20 61 20 73 69 6d 70 | 6c 65 20 76 61 6c 75 65 |f a simp|le value|
|00000b00| 2c 20 74 68 65 73 65 20 | 63 6f 6d 6d 61 6e 64 73 |, these |commands|
|00000b10| 20 6e 6f 77 20 61 63 63 | 65 70 74 20 61 6e 20 69 | now acc|ept an i|
|00000b20| 6e 66 69 78 0a 25 20 6e | 6f 74 61 74 69 6f 6e 20 |nfix.% n|otation |
|00000b30| 65 78 70 72 65 73 73 69 | 6f 6e 2e 0a 25 20 5c 65 |expressi|on..% \e|
|00000b40| 6e 64 7b 61 62 73 74 72 | 61 63 74 7d 0a 25 20 0a |nd{abstr|act}.% .|
|00000b50| 25 20 5c 73 65 63 74 69 | 6f 6e 7b 49 6e 74 72 6f |% \secti|on{Intro|
|00000b60| 64 75 63 74 69 6f 6e 7d | 0a 25 0a 25 20 41 72 69 |duction}|.%.% Ari|
|00000b70| 74 68 6d 65 74 69 63 20 | 69 6e 20 5c 54 65 58 5c |thmetic |in \TeX\|
|00000b80| 20 69 73 20 64 6f 6e 65 | 20 75 73 69 6e 67 20 6c | is done| using l|
|00000b90| 6f 77 2d 6c 65 76 65 6c | 20 6f 70 65 72 61 74 69 |ow-level| operati|
|00000ba0| 6f 6e 73 20 73 75 63 68 | 20 61 73 0a 25 20 7c 5c |ons such| as.% |\|
|00000bb0| 61 64 76 61 6e 63 65 7c | 20 61 6e 64 20 7c 5c 6d |advance|| and |\m|
|00000bc0| 75 6c 74 69 70 6c 79 7c | 2e 20 20 54 68 69 73 20 |ultiply||. This |
|00000bd0| 6d 61 79 20 62 65 20 61 | 63 63 65 70 74 61 62 6c |may be a|cceptabl|
|00000be0| 65 20 77 68 65 6e 20 64 | 65 76 65 6c 6f 70 69 6e |e when d|evelopin|
|00000bf0| 67 0a 25 20 61 20 6d 61 | 63 72 6f 20 70 61 63 6b |g.% a ma|cro pack|
|00000c00| 61 67 65 2c 20 62 75 74 | 20 69 74 20 69 73 20 6e |age, but| it is n|
|00000c10| 6f 74 20 61 6e 20 61 63 | 63 65 70 74 61 62 6c 65 |ot an ac|ceptable|
|00000c20| 20 69 6e 74 65 72 66 61 | 63 65 20 66 6f 72 20 74 | interfa|ce for t|
|00000c30| 68 65 0a 25 20 65 6e 64 | 2d 75 73 65 72 2e 0a 25 |he.% end|-user..%|
|00000c40| 0a 25 20 54 68 69 73 20 | 70 61 63 6b 61 67 65 20 |.% This |package |
|00000c50| 69 6e 74 72 6f 64 75 63 | 65 73 20 70 72 6f 70 65 |introduc|es prope|
|00000c60| 72 20 69 6e 66 69 78 20 | 6e 6f 74 61 74 69 6f 6e |r infix |notation|
|00000c70| 20 61 72 69 74 68 6d 65 | 74 69 63 20 77 68 69 63 | arithme|tic whic|
|00000c80| 68 20 69 73 0a 25 20 6d | 75 63 68 20 6d 6f 72 65 |h is.% m|uch more|
|00000c90| 20 66 61 6d 69 6c 69 61 | 72 20 74 6f 20 6d 6f 73 | familia|r to mos|
|00000ca0| 74 20 70 65 6f 70 6c 65 | 2e 20 20 54 68 65 20 69 |t people|. The i|
|00000cb0| 6e 66 69 78 20 6e 6f 74 | 61 74 69 6f 6e 20 69 73 |nfix not|ation is|
|00000cc0| 20 6d 6f 72 65 0a 25 20 | 72 65 61 64 61 62 6c 65 | more.% |readable|
|00000cd0| 20 61 6e 64 20 65 61 73 | 69 65 72 20 74 6f 20 6d | and eas|ier to m|
|00000ce0| 6f 64 69 66 79 20 74 68 | 61 6e 20 74 68 65 20 61 |odify th|an the a|
|00000cf0| 6c 74 65 72 6e 61 74 69 | 76 65 3a 20 61 20 73 65 |lternati|ve: a se|
|00000d00| 71 75 65 6e 63 65 20 6f | 66 0a 25 20 61 73 73 69 |quence o|f.% assi|
|00000d10| 67 6e 6d 65 6e 74 20 61 | 6e 64 20 61 72 69 74 68 |gnment a|nd arith|
|00000d20| 6d 65 74 69 63 20 69 6e | 73 74 72 75 63 74 69 6f |metic in|structio|
|00000d30| 6e 73 2e 20 20 4f 6e 65 | 20 6f 66 20 74 68 65 20 |ns. One| of the |
|00000d40| 61 72 69 74 68 6d 65 74 | 69 63 0a 25 20 69 6e 73 |arithmet|ic.% ins|
|00000d50| 74 72 75 63 74 69 6f 6e | 73 20 28 7c 5c 64 69 76 |truction|s (|\div|
|00000d60| 69 64 65 7c 29 20 64 6f | 65 73 20 6e 6f 74 20 65 |ide|) do|es not e|
|00000d70| 76 65 6e 20 68 61 76 65 | 20 61 6e 20 65 71 75 69 |ven have| an equi|
|00000d80| 76 61 6c 65 6e 74 20 69 | 6e 0a 25 20 73 74 61 6e |valent i|n.% stan|
|00000d90| 64 61 72 64 20 5c 4c 61 | 54 65 58 2e 0a 25 0a 25 |dard \La|TeX..%.%|
|00000da0| 20 54 68 65 20 69 6e 66 | 69 78 20 65 78 70 72 65 | The inf|ix expre|
|00000db0| 73 73 69 6f 6e 73 20 63 | 61 6e 20 62 65 20 75 73 |ssions c|an be us|
|00000dc0| 65 64 20 69 6e 20 61 72 | 67 75 6d 65 6e 74 73 20 |ed in ar|guments |
|00000dd0| 74 6f 20 6d 61 63 72 6f | 73 20 28 74 68 65 0a 25 |to macro|s (the.%|
|00000de0| 20 5c 74 65 78 74 74 74 | 7b 63 61 6c 63 7d 20 70 | \texttt|{calc} p|
|00000df0| 61 63 6b 61 67 65 20 64 | 6f 65 73 6e 27 74 20 65 |ackage d|oesn't e|
|00000e00| 6d 70 6c 6f 79 20 63 61 | 74 65 67 6f 72 79 20 63 |mploy ca|tegory c|
|00000e10| 6f 64 65 20 63 68 61 6e | 67 65 73 20 74 6f 0a 25 |ode chan|ges to.%|
|00000e20| 20 61 63 68 69 65 76 65 | 20 69 74 73 20 67 6f 61 | achieve| its goa|
|00000e30| 6c 73 29 2e 20 0a 25 0a | 25 20 5c 73 65 63 74 69 |ls). .%.|% \secti|
|00000e40| 6f 6e 7b 49 6e 66 6f 72 | 6d 61 6c 20 64 65 73 63 |on{Infor|mal desc|
|00000e50| 72 69 70 74 69 6f 6e 7d | 0a 25 0a 25 20 53 74 61 |ription}|.%.% Sta|
|00000e60| 6e 64 61 72 64 20 5c 4c | 61 54 65 58 5c 20 70 72 |ndard \L|aTeX\ pr|
|00000e70| 6f 76 69 64 65 73 20 74 | 68 65 20 66 6f 6c 6c 6f |ovides t|he follo|
|00000e80| 77 69 6e 67 20 73 65 74 | 20 6f 66 20 63 6f 6d 6d |wing set| of comm|
|00000e90| 61 6e 64 73 20 74 6f 0a | 25 20 6d 61 6e 69 70 75 |ands to.|% manipu|
|00000ea0| 6c 61 74 65 20 63 6f 75 | 6e 74 65 72 73 20 61 6e |late cou|nters an|
|00000eb0| 64 20 6c 65 6e 67 74 68 | 73 20 5c 63 69 74 65 5b |d length|s \cite[|
|00000ec0| 70 61 67 65 73 20 31 39 | 34 20 61 6e 64 7e 32 31 |pages 19|4 and~21|
|00000ed0| 36 5d 7b 6c 61 74 65 78 | 6d 61 6e 7d 2e 0a 25 20 |6]{latex|man}..% |
|00000ee0| 5c 62 65 67 69 6e 7b 69 | 74 65 6d 69 7a 65 7d 0a |\begin{i|temize}.|
|00000ef0| 25 20 5c 69 74 65 6d 5b | 5d 5c 68 73 6b 69 70 2d |% \item[|]\hskip-|
|00000f00| 5c 6c 65 66 74 6d 61 72 | 67 69 6e 0a 25 20 20 20 |\leftmar|gin.% |
|00000f10| 20 7c 5c 73 65 74 63 6f | 75 6e 74 65 72 7b 7c 5c | |\setco|unter{|\|
|00000f20| 74 65 78 74 69 74 7b 63 | 74 72 7d 7c 7d 7b 7c 5c |textit{c|tr}|}{|\|
|00000f30| 74 65 78 74 69 74 7b 6e | 75 6d 7d 7c 7d 7c 20 73 |textit{n|um}|}| s|
|00000f40| 65 74 73 20 74 68 65 0a | 25 20 20 20 20 76 61 6c |ets the.|% val|
|00000f50| 75 65 20 6f 66 20 74 68 | 65 20 63 6f 75 6e 74 65 |ue of th|e counte|
|00000f60| 72 20 5c 74 65 78 74 69 | 74 7b 63 74 72 7d 20 65 |r \texti|t{ctr} e|
|00000f70| 71 75 61 6c 20 74 6f 20 | 28 74 68 65 20 76 61 6c |qual to |(the val|
|00000f80| 75 65 20 6f 66 29 0a 25 | 20 20 20 20 5c 74 65 78 |ue of).%| \tex|
|00000f90| 74 69 74 7b 6e 75 6d 7d | 2e 20 20 28 46 72 61 67 |tit{num}|. (Frag|
|00000fa0| 69 6c 65 29 0a 25 20 5c | 69 74 65 6d 5b 5d 5c 68 |ile).% \|item[]\h|
|00000fb0| 73 6b 69 70 2d 5c 6c 65 | 66 74 6d 61 72 67 69 6e |skip-\le|ftmargin|
|00000fc0| 0a 25 20 20 20 20 7c 5c | 61 64 64 74 6f 63 6f 75 |.% |\|addtocou|
|00000fd0| 6e 74 65 72 7b 7c 5c 74 | 65 78 74 69 74 7b 63 74 |nter{|\t|extit{ct|
|00000fe0| 72 7d 7c 7d 7b 7c 5c 74 | 65 78 74 69 74 7b 6e 75 |r}|}{|\t|extit{nu|
|00000ff0| 6d 7d 7c 7d 7c 0a 25 20 | 20 20 20 69 6e 63 72 65 |m}|}|.% | incre|
|00001000| 6d 65 6e 74 73 20 74 68 | 65 20 76 61 6c 75 65 20 |ments th|e value |
|00001010| 6f 66 20 74 68 65 20 63 | 6f 75 6e 74 65 72 20 5c |of the c|ounter \|
|00001020| 74 65 78 74 69 74 7b 63 | 74 72 7d 20 62 79 20 28 |textit{c|tr} by (|
|00001030| 74 68 65 0a 25 20 20 20 | 20 76 61 6c 75 65 20 6f |the.% | value o|
|00001040| 66 29 20 5c 74 65 78 74 | 69 74 7b 6e 75 6d 7d 2e |f) \text|it{num}.|
|00001050| 20 20 28 46 72 61 67 69 | 6c 65 29 0a 25 0a 25 20 | (Fragi|le).%.% |
|00001060| 5c 69 74 65 6d 5b 5d 5c | 68 73 6b 69 70 2d 5c 6c |\item[]\|hskip-\l|
|00001070| 65 66 74 6d 61 72 67 69 | 6e 0a 25 20 20 20 20 7c |eftmargi|n.% ||
|00001080| 5c 73 65 74 6c 65 6e 67 | 74 68 7b 7c 5c 74 65 78 |\setleng|th{|\tex|
|00001090| 74 69 74 7b 63 6d 64 7d | 7c 7d 7b 7c 5c 74 65 78 |tit{cmd}||}{|\tex|
|000010a0| 74 69 74 7b 6c 65 6e 7d | 7c 7d 7c 20 73 65 74 73 |tit{len}||}| sets|
|000010b0| 20 74 68 65 20 76 61 6c | 75 65 20 6f 66 0a 25 20 | the val|ue of.% |
|000010c0| 20 20 20 74 68 65 20 6c | 65 6e 67 74 68 20 63 6f | the l|ength co|
|000010d0| 6d 6d 61 6e 64 20 5c 74 | 65 78 74 69 74 7b 63 6d |mmand \t|extit{cm|
|000010e0| 64 7d 20 65 71 75 61 6c | 20 74 6f 20 28 74 68 65 |d} equal| to (the|
|000010f0| 20 76 61 6c 75 65 20 6f | 66 29 20 5c 74 65 78 74 | value o|f) \text|
|00001100| 69 74 7b 6c 65 6e 7d 2e | 0a 25 20 20 20 20 28 52 |it{len}.|.% (R|
|00001110| 6f 62 75 73 74 29 0a 25 | 20 5c 69 74 65 6d 5b 5d |obust).%| \item[]|
|00001120| 5c 68 73 6b 69 70 2d 5c | 6c 65 66 74 6d 61 72 67 |\hskip-\|leftmarg|
|00001130| 69 6e 0a 25 20 20 20 20 | 7c 5c 61 64 64 74 6f 6c |in.% ||\addtol|
|00001140| 65 6e 67 74 68 7b 7c 5c | 74 65 78 74 69 74 7b 63 |ength{|\|textit{c|
|00001150| 6d 64 7d 7c 7d 7b 7c 5c | 74 65 78 74 69 74 7b 6c |md}|}{|\|textit{l|
|00001160| 65 6e 7d 7c 7d 7c 20 73 | 65 74 73 20 74 68 65 20 |en}|}| s|ets the |
|00001170| 76 61 6c 75 65 20 6f 66 | 0a 25 20 20 20 20 74 68 |value of|.% th|
|00001180| 65 20 6c 65 6e 67 74 68 | 20 63 6f 6d 6d 61 6e 64 |e length| command|
|00001190| 20 5c 74 65 78 74 69 74 | 7b 63 6d 64 7d 20 65 71 | \textit|{cmd} eq|
|000011a0| 75 61 6c 20 74 6f 20 69 | 74 73 20 63 75 72 72 65 |ual to i|ts curre|
|000011b0| 6e 74 20 76 61 6c 75 65 | 20 70 6c 75 73 0a 25 20 |nt value| plus.% |
|000011c0| 20 20 20 28 74 68 65 20 | 76 61 6c 75 65 20 6f 66 | (the |value of|
|000011d0| 29 20 5c 74 65 78 74 69 | 74 7b 6c 65 6e 7d 2e 20 |) \texti|t{len}. |
|000011e0| 20 28 52 6f 62 75 73 74 | 29 0a 25 20 5c 65 6e 64 | (Robust|).% \end|
|000011f0| 7b 69 74 65 6d 69 7a 65 | 7d 0a 25 20 28 54 68 65 |{itemize|}.% (The|
|00001200| 20 7c 5c 73 65 74 63 6f | 75 6e 74 65 72 7c 20 61 | |\setco|unter| a|
|00001210| 6e 64 20 7c 5c 61 64 64 | 74 6f 63 6f 75 6e 74 65 |nd |\add|tocounte|
|00001220| 72 7c 20 63 6f 6d 6d 61 | 6e 64 73 20 68 61 76 65 |r| comma|nds have|
|00001230| 20 67 6c 6f 62 61 6c 20 | 65 66 66 65 63 74 2c 0a | global |effect,.|
|00001240| 25 20 77 68 69 6c 65 20 | 74 68 65 20 7c 5c 73 65 |% while |the |\se|
|00001250| 74 6c 65 6e 67 74 68 7c | 20 61 6e 64 20 7c 5c 61 |tlength|| and |\a|
|00001260| 64 64 74 6f 6c 65 6e 67 | 74 68 7c 20 63 6f 6d 6d |ddtoleng|th| comm|
|00001270| 61 6e 64 73 20 6f 62 65 | 79 20 74 68 65 20 6e 6f |ands obe|y the no|
|00001280| 72 6d 61 6c 0a 25 20 73 | 63 6f 70 69 6e 67 20 72 |rmal.% s|coping r|
|00001290| 75 6c 65 73 2e 29 20 20 | 49 6e 20 73 74 61 6e 64 |ules.) |In stand|
|000012a0| 61 72 64 20 5c 4c 61 54 | 65 58 2c 20 74 68 65 20 |ard \LaT|eX, the |
|000012b0| 61 72 67 75 6d 65 6e 74 | 73 20 74 6f 20 74 68 65 |argument|s to the|
|000012c0| 73 65 20 63 6f 6d 6d 61 | 6e 64 73 0a 25 20 6d 75 |se comma|nds.% mu|
|000012d0| 73 74 20 62 65 20 73 69 | 6d 70 6c 65 20 76 61 6c |st be si|mple val|
|000012e0| 75 65 73 2e 20 20 54 68 | 65 20 5c 74 65 78 74 74 |ues. Th|e \textt|
|000012f0| 74 7b 63 61 6c 63 7d 20 | 70 61 63 6b 61 67 65 20 |t{calc} |package |
|00001300| 65 78 74 65 6e 64 73 20 | 74 68 65 73 65 0a 25 20 |extends |these.% |
|00001310| 63 6f 6d 6d 61 6e 64 73 | 20 74 6f 20 61 63 63 65 |commands| to acce|
|00001320| 70 74 20 69 6e 66 69 78 | 20 6e 6f 74 61 74 69 6f |pt infix| notatio|
|00001330| 6e 20 65 78 70 72 65 73 | 73 69 6f 6e 73 2c 20 64 |n expres|sions, d|
|00001340| 65 6e 6f 74 69 6e 67 20 | 76 61 6c 75 65 73 20 6f |enoting |values o|
|00001350| 66 0a 25 20 61 70 70 72 | 6f 70 72 69 61 74 65 20 |f.% appr|opriate |
|00001360| 74 79 70 65 73 2e 20 20 | 55 73 69 6e 67 20 74 68 |types. |Using th|
|00001370| 65 20 5c 74 65 78 74 74 | 74 7b 63 61 6c 63 7d 20 |e \textt|t{calc} |
|00001380| 70 61 63 6b 61 67 65 2c | 20 5c 74 65 78 74 69 74 |package,| \textit|
|00001390| 7b 6e 75 6d 7d 20 69 73 | 0a 25 20 72 65 70 6c 61 |{num} is|.% repla|
|000013a0| 63 65 64 20 62 79 20 5c | 3c 69 6e 74 65 67 65 72 |ced by \|<integer|
|000013b0| 20 65 78 70 72 65 73 73 | 69 6f 6e 3e 2c 20 61 6e | express|ion>, an|
|000013c0| 64 20 5c 74 65 78 74 69 | 74 7b 6c 65 6e 7d 20 69 |d \texti|t{len} i|
|000013d0| 73 20 72 65 70 6c 61 63 | 65 64 20 62 79 0a 25 20 |s replac|ed by.% |
|000013e0| 5c 3c 67 6c 75 65 20 65 | 78 70 72 65 73 73 69 6f |\<glue e|xpressio|
|000013f0| 6e 3e 2e 20 20 54 68 65 | 20 66 6f 72 6d 61 6c 20 |n>. The| formal |
|00001400| 73 79 6e 74 61 78 20 6f | 66 20 5c 3c 69 6e 74 65 |syntax o|f \<inte|
|00001410| 67 65 72 20 65 78 70 72 | 65 73 73 69 6f 6e 3e 20 |ger expr|ession> |
|00001420| 61 6e 64 0a 25 20 5c 3c | 67 6c 75 65 20 65 78 70 |and.% \<|glue exp|
|00001430| 72 65 73 73 69 6f 6e 3e | 20 69 73 20 67 69 76 65 |ression>| is give|
|00001440| 6e 20 62 65 6c 6f 77 2e | 0a 25 0a 25 20 49 6e 20 |n below.|.%.% In |
|00001450| 74 68 65 20 66 6f 6c 6c | 6f 77 69 6e 67 2c 20 77 |the foll|owing, w|
|00001460| 65 20 73 68 61 6c 6c 20 | 75 73 65 20 73 74 61 6e |e shall |use stan|
|00001470| 64 61 72 64 20 5c 54 65 | 58 5c 20 74 65 72 6d 69 |dard \Te|X\ termi|
|00001480| 6e 6f 6c 6f 67 79 2e 20 | 20 54 68 65 0a 25 20 63 |nology. | The.% c|
|00001490| 6f 72 72 65 73 70 6f 6e | 64 65 6e 63 65 20 62 65 |orrespon|dence be|
|000014a0| 74 77 65 65 6e 20 5c 54 | 65 58 5c 20 61 6e 64 20 |tween \T|eX\ and |
|000014b0| 5c 4c 61 54 65 58 5c 20 | 74 65 72 6d 69 6e 6f 6c |\LaTeX\ |terminol|
|000014c0| 6f 67 79 20 69 73 20 61 | 73 20 66 6f 6c 6c 6f 77 |ogy is a|s follow|
|000014d0| 73 3a 0a 25 20 5c 4c 61 | 54 65 58 5c 20 63 6f 75 |s:.% \La|TeX\ cou|
|000014e0| 6e 74 65 72 73 20 63 6f | 72 72 65 73 70 6f 6e 64 |nters co|rrespond|
|000014f0| 20 74 6f 20 5c 54 65 58 | 27 73 20 63 6f 75 6e 74 | to \TeX|'s count|
|00001500| 20 72 65 67 69 73 74 65 | 72 73 3b 20 74 68 65 79 | registe|rs; they|
|00001510| 20 68 6f 6c 64 0a 25 20 | 71 75 61 6e 74 69 74 69 | hold.% |quantiti|
|00001520| 65 73 20 6f 66 20 74 79 | 70 65 20 5c 3c 6e 75 6d |es of ty|pe \<num|
|00001530| 62 65 72 3e 2e 20 20 5c | 4c 61 54 65 58 5c 20 6c |ber>. \|LaTeX\ l|
|00001540| 65 6e 67 74 68 20 63 6f | 6d 6d 61 6e 64 73 20 63 |ength co|mmands c|
|00001550| 6f 72 72 65 73 70 6f 6e | 64 20 74 6f 0a 25 20 5c |orrespon|d to.% \|
|00001560| 54 65 58 27 73 20 64 69 | 6d 65 6e 20 28 66 6f 72 |TeX's di|men (for|
|00001570| 20 72 69 67 69 64 20 6c | 65 6e 67 74 68 73 29 20 | rigid l|engths) |
|00001580| 61 6e 64 20 73 6b 69 70 | 20 28 66 6f 72 20 72 75 |and skip| (for ru|
|00001590| 62 62 65 72 20 6c 65 6e | 67 74 68 73 29 0a 25 20 |bber len|gths).% |
|000015a0| 72 65 67 69 73 74 65 72 | 73 3b 20 74 68 65 79 20 |register|s; they |
|000015b0| 68 6f 6c 64 20 71 75 61 | 6e 74 69 74 69 65 73 20 |hold qua|ntities |
|000015c0| 6f 66 20 74 79 70 65 73 | 20 5c 3c 64 69 6d 65 6e |of types| \<dimen|
|000015d0| 3e 20 61 6e 64 20 5c 3c | 67 6c 75 65 3e 2c 0a 25 |> and \<|glue>,.%|
|000015e0| 20 72 65 73 70 65 63 74 | 69 76 65 6c 79 2e 0a 25 | respect|ively..%|
|000015f0| 0a 25 20 5c 54 65 58 5c | 20 67 69 76 65 73 20 75 |.% \TeX\| gives u|
|00001600| 73 20 70 72 69 6d 69 74 | 69 76 65 20 6f 70 65 72 |s primit|ive oper|
|00001610| 61 74 69 6f 6e 73 20 74 | 6f 20 70 65 72 66 6f 72 |ations t|o perfor|
|00001620| 6d 20 61 72 69 74 68 6d | 65 74 69 63 20 6f 6e 20 |m arithm|etic on |
|00001630| 72 65 67 69 73 74 65 72 | 73 20 61 73 0a 25 20 66 |register|s as.% f|
|00001640| 6f 6c 6c 6f 77 73 3a 0a | 25 20 5c 62 65 67 69 6e |ollows:.|% \begin|
|00001650| 7b 69 74 65 6d 69 7a 65 | 7d 0a 25 20 20 20 5c 69 |{itemize|}.% \i|
|00001660| 74 65 6d 20 61 64 64 69 | 74 69 6f 6e 20 61 6e 64 |tem addi|tion and|
|00001670| 20 73 75 62 74 72 61 63 | 74 69 6f 6e 20 6f 6e 20 | subtrac|tion on |
|00001680| 61 6c 6c 20 74 79 70 65 | 73 20 6f 66 20 71 75 61 |all type|s of qua|
|00001690| 6e 74 69 74 69 65 73 20 | 77 69 74 68 6f 75 74 0a |ntities |without.|
|000016a0| 25 09 72 65 73 74 72 69 | 63 74 69 6f 6e 73 3b 0a |%.restri|ctions;.|
|000016b0| 25 20 20 20 5c 69 74 65 | 6d 20 6d 75 6c 74 69 70 |% \ite|m multip|
|000016c0| 6c 69 63 61 74 69 6f 6e | 20 61 6e 64 20 64 69 76 |lication| and div|
|000016d0| 69 73 69 6f 6e 20 62 79 | 20 61 6e 20 5c 65 6d 70 |ision by| an \emp|
|000016e0| 68 7b 69 6e 74 65 67 65 | 72 7d 20 63 61 6e 20 62 |h{intege|r} can b|
|000016f0| 65 0a 25 09 70 65 72 66 | 6f 72 6d 65 64 20 6f 6e |e.%.perf|ormed on|
|00001700| 20 61 20 72 65 67 69 73 | 74 65 72 20 6f 66 20 61 | a regis|ter of a|
|00001710| 6e 79 20 74 79 70 65 3b | 0a 25 20 20 20 5c 69 74 |ny type;|.% \it|
|00001720| 65 6d 20 6d 75 6c 74 69 | 70 6c 69 63 61 74 69 6f |em multi|plicatio|
|00001730| 6e 20 62 79 20 61 20 5c | 65 6d 70 68 7b 72 65 61 |n by a \|emph{rea|
|00001740| 6c 7d 20 6e 75 6d 62 65 | 72 20 28 69 2e 65 2e 2c |l} numbe|r (i.e.,|
|00001750| 20 61 20 6e 75 6d 62 65 | 72 20 77 69 74 68 20 61 | a numbe|r with a|
|00001760| 0a 25 09 66 72 61 63 74 | 69 6f 6e 61 6c 20 70 61 |.%.fract|ional pa|
|00001770| 72 74 29 20 63 61 6e 20 | 62 65 20 70 65 72 66 6f |rt) can |be perfo|
|00001780| 72 6d 65 64 20 6f 6e 20 | 61 20 72 65 67 69 73 74 |rmed on |a regist|
|00001790| 65 72 20 6f 66 20 61 6e | 79 20 74 79 70 65 2c 0a |er of an|y type,.|
|000017a0| 25 09 62 75 74 20 74 68 | 65 20 73 74 72 65 74 63 |%.but th|e stretc|
|000017b0| 68 20 61 6e 64 20 73 68 | 72 69 6e 6b 20 63 6f 6d |h and sh|rink com|
|000017c0| 70 6f 6e 65 6e 74 73 20 | 6f 66 20 61 20 67 6c 75 |ponents |of a glu|
|000017d0| 65 20 71 75 61 6e 74 69 | 74 79 20 61 72 65 0a 25 |e quanti|ty are.%|
|000017e0| 09 64 69 73 63 61 72 64 | 65 64 2e 0a 25 20 5c 65 |.discard|ed..% \e|
|000017f0| 6e 64 7b 69 74 65 6d 69 | 7a 65 7d 0a 25 20 54 68 |nd{itemi|ze}.% Th|
|00001800| 65 20 5c 74 65 78 74 74 | 74 7b 63 61 6c 63 7d 20 |e \textt|t{calc} |
|00001810| 70 61 63 6b 61 67 65 20 | 75 73 65 73 20 74 68 65 |package |uses the|
|00001820| 73 65 20 5c 54 65 58 5c | 20 70 72 69 6d 69 74 69 |se \TeX\| primiti|
|00001830| 76 65 73 20 62 75 74 20 | 70 72 6f 76 69 64 65 73 |ves but |provides|
|00001840| 20 61 0a 25 20 6d 6f 72 | 65 20 75 73 65 72 2d 66 | a.% mor|e user-f|
|00001850| 72 69 65 6e 64 6c 79 20 | 6e 6f 74 61 74 69 6f 6e |riendly |notation|
|00001860| 20 66 6f 72 20 65 78 70 | 72 65 73 73 69 6e 67 20 | for exp|ressing |
|00001870| 74 68 65 20 61 72 69 74 | 68 6d 65 74 69 63 2e 0a |the arit|hmetic..|
|00001880| 25 0a 25 20 41 6e 20 65 | 78 70 72 65 73 73 69 6f |%.% An e|xpressio|
|00001890| 6e 20 69 73 20 66 6f 72 | 6d 65 64 20 6f 66 20 6e |n is for|med of n|
|000018a0| 75 6d 65 72 69 63 61 6c | 20 71 75 61 6e 74 69 74 |umerical| quantit|
|000018b0| 69 74 65 73 20 28 73 75 | 63 68 20 61 73 20 65 78 |ites (su|ch as ex|
|000018c0| 70 6c 69 63 69 74 0a 25 | 20 63 6f 6e 73 74 61 6e |plicit.%| constan|
|000018d0| 74 73 20 61 6e 64 20 5c | 4c 61 54 65 58 5c 20 63 |ts and \|LaTeX\ c|
|000018e0| 6f 75 6e 74 65 72 73 20 | 61 6e 64 20 6c 65 6e 67 |ounters |and leng|
|000018f0| 74 68 20 63 6f 6d 6d 61 | 6e 64 73 29 20 61 6e 64 |th comma|nds) and|
|00001900| 20 62 69 6e 61 72 79 0a | 25 20 6f 70 65 72 61 74 | binary.|% operat|
|00001910| 6f 72 73 20 28 74 68 65 | 20 74 6f 6b 65 6e 73 20 |ors (the| tokens |
|00001920| 60 5c 74 65 78 74 74 74 | 7b 2b 7d 27 2c 20 60 5c |`\texttt|{+}', `\|
|00001930| 74 65 78 74 74 74 7b 2d | 7d 27 2c 20 60 5c 74 65 |texttt{-|}', `\te|
|00001940| 78 74 74 74 7b 2a 7d 27 | 2c 20 61 6e 64 0a 25 20 |xttt{*}'|, and.% |
|00001950| 60 5c 74 65 78 74 74 74 | 7b 2f 7d 27 20 77 69 74 |`\texttt|{/}' wit|
|00001960| 68 20 74 68 65 69 72 20 | 75 73 75 61 6c 20 6d 65 |h their |usual me|
|00001970| 61 6e 69 6e 67 29 20 75 | 73 69 6e 67 20 74 68 65 |aning) u|sing the|
|00001980| 20 66 61 6d 69 6c 69 61 | 72 20 69 6e 66 69 78 0a | familia|r infix.|
|00001990| 25 20 6e 6f 74 61 74 69 | 6f 6e 3b 20 70 61 72 65 |% notati|on; pare|
|000019a0| 6e 74 68 65 73 65 73 20 | 6d 61 79 20 62 65 20 75 |ntheses |may be u|
|000019b0| 73 65 64 20 74 6f 20 6f | 76 65 72 72 69 64 65 20 |sed to o|verride |
|000019c0| 74 68 65 20 75 73 75 61 | 6c 20 70 72 65 63 65 64 |the usua|l preced|
|000019d0| 65 6e 63 65 73 0a 25 20 | 28 74 68 61 74 20 6d 75 |ences.% |(that mu|
|000019e0| 6c 74 69 70 6c 69 63 61 | 74 69 6f 6e 2f 64 69 76 |ltiplica|tion/div|
|000019f0| 69 73 69 6f 6e 20 68 61 | 76 65 20 68 69 67 68 65 |ision ha|ve highe|
|00001a00| 72 20 70 72 65 63 65 64 | 65 6e 63 65 20 74 68 61 |r preced|ence tha|
|00001a10| 6e 0a 25 20 61 64 64 69 | 74 69 6f 6e 2f 73 75 62 |n.% addi|tion/sub|
|00001a20| 74 72 61 63 74 69 6f 6e | 29 2e 20 0a 25 0a 25 20 |traction|). .%.% |
|00001a30| 45 78 70 72 65 73 73 69 | 6f 6e 73 20 6d 75 73 74 |Expressi|ons must|
|00001a40| 20 62 65 20 70 72 6f 70 | 65 72 6c 79 20 74 79 70 | be prop|erly typ|
|00001a50| 65 64 2e 20 20 54 68 69 | 73 20 6d 65 61 6e 73 2c |ed. Thi|s means,|
|00001a60| 20 65 2e 67 2e 2c 20 74 | 68 61 74 20 61 20 64 69 | e.g., t|hat a di|
|00001a70| 6d 65 6e 20 0a 25 20 65 | 78 70 72 65 73 73 69 6f |men .% e|xpressio|
|00001a80| 6e 20 6d 75 73 74 20 62 | 65 20 61 20 73 75 6d 20 |n must b|e a sum |
|00001a90| 6f 66 20 64 69 6d 65 6e | 20 74 65 72 6d 73 3a 20 |of dimen| terms: |
|00001aa0| 69 2e 65 2e 2c 20 79 6f | 75 20 63 61 6e 6e 6f 74 |i.e., yo|u cannot|
|00001ab0| 20 73 61 79 0a 25 20 60 | 5c 74 65 78 74 74 74 7b | say.% `|\texttt{|
|00001ac0| 32 63 6d 2b 34 7d 27 20 | 62 75 74 20 60 5c 74 65 |2cm+4}' |but `\te|
|00001ad0| 78 74 74 74 7b 32 63 6d | 2b 34 70 74 7d 27 20 69 |xttt{2cm|+4pt}' i|
|00001ae0| 73 20 76 61 6c 69 64 2e | 0a 25 0a 25 20 49 6e 20 |s valid.|.%.% In |
|00001af0| 61 20 64 69 6d 65 6e 20 | 74 65 72 6d 2c 20 74 68 |a dimen |term, th|
|00001b00| 65 20 64 69 6d 65 6e 73 | 69 6f 6e 20 70 61 72 74 |e dimens|ion part|
|00001b10| 20 6d 75 73 74 20 63 6f | 6d 65 20 66 69 72 73 74 | must co|me first|
|00001b20| 3b 20 74 68 65 20 73 61 | 6d 65 20 68 6f 6c 64 73 |; the sa|me holds|
|00001b30| 0a 25 20 66 6f 72 20 67 | 6c 75 65 20 74 65 72 6d |.% for g|lue term|
|00001b40| 73 2e 20 20 41 6c 73 6f | 2c 20 6d 75 6c 74 69 70 |s. Also|, multip|
|00001b50| 6c 69 63 61 74 69 6f 6e | 20 61 6e 64 20 64 69 76 |lication| and div|
|00001b60| 69 73 69 6f 6e 20 62 79 | 20 6e 6f 6e 2d 69 6e 74 |ision by| non-int|
|00001b70| 65 67 65 72 0a 25 20 71 | 75 61 6e 74 69 74 69 65 |eger.% q|uantitie|
|00001b80| 73 20 72 65 71 75 69 72 | 65 20 61 20 73 70 65 63 |s requir|e a spec|
|00001b90| 69 61 6c 20 73 79 6e 74 | 61 78 3b 20 73 65 65 20 |ial synt|ax; see |
|00001ba0| 62 65 6c 6f 77 2e 0a 25 | 0a 25 20 45 76 61 6c 75 |below..%|.% Evalu|
|00001bb0| 61 74 69 6f 6e 20 6f 66 | 20 73 75 62 65 78 70 72 |ation of| subexpr|
|00001bc0| 65 73 73 69 6f 6e 73 20 | 61 74 20 74 68 65 20 73 |essions |at the s|
|00001bd0| 61 6d 65 20 6c 65 76 65 | 6c 20 6f 66 20 70 72 65 |ame leve|l of pre|
|00001be0| 63 65 64 65 6e 63 65 0a | 25 20 70 72 6f 63 65 65 |cedence.|% procee|
|00001bf0| 64 73 20 66 72 6f 6d 20 | 6c 65 66 74 20 74 6f 20 |ds from |left to |
|00001c00| 72 69 67 68 74 2e 20 20 | 43 6f 6e 73 69 64 65 72 |right. |Consider|
|00001c10| 20 61 20 64 69 6d 65 6e | 20 74 65 72 6d 20 73 75 | a dimen| term su|
|00001c20| 63 68 20 61 73 0a 25 20 | 60 60 5c 74 65 78 74 74 |ch as.% |``\textt|
|00001c30| 74 7b 34 63 6d 2a 33 2a | 34 7d 27 27 2e 20 20 46 |t{4cm*3*|4}''. F|
|00001c40| 69 72 73 74 2c 20 74 68 | 65 20 76 61 6c 75 65 20 |irst, th|e value |
|00001c50| 6f 66 20 74 68 65 20 66 | 61 63 74 6f 72 20 5c 74 |of the f|actor \t|
|00001c60| 65 78 74 74 74 7b 34 63 | 6d 7d 20 69 73 0a 25 20 |exttt{4c|m} is.% |
|00001c70| 61 73 73 69 67 6e 65 64 | 20 74 6f 20 61 20 64 69 |assigned| to a di|
|00001c80| 6d 65 6e 20 72 65 67 69 | 73 74 65 72 2c 20 74 68 |men regi|ster, th|
|00001c90| 65 6e 20 74 68 69 73 20 | 72 65 67 69 73 74 65 72 |en this |register|
|00001ca0| 20 69 73 20 6d 75 6c 74 | 69 70 6c 69 65 64 0a 25 | is mult|iplied.%|
|00001cb0| 20 62 79 7e 24 33 24 20 | 28 75 73 69 6e 67 20 7c | by~$3$ |(using ||
|00001cc0| 5c 6d 75 6c 74 69 70 6c | 79 7c 29 2c 20 61 6e 64 |\multipl|y|), and|
|00001cd0| 2c 20 66 69 6e 61 6c 6c | 79 2c 20 74 68 65 20 72 |, finall|y, the r|
|00001ce0| 65 67 69 73 74 65 72 20 | 69 73 20 6d 75 6c 74 69 |egister |is multi|
|00001cf0| 70 6c 69 65 64 0a 25 20 | 62 79 7e 24 34 24 20 28 |plied.% |by~$4$ (|
|00001d00| 61 67 61 69 6e 20 75 73 | 69 6e 67 20 7c 5c 6d 75 |again us|ing |\mu|
|00001d10| 6c 74 69 70 6c 79 7c 29 | 2e 20 20 54 68 69 73 20 |ltiply|)|. This |
|00001d20| 61 6c 73 6f 20 65 78 70 | 6c 61 69 6e 73 20 77 68 |also exp|lains wh|
|00001d30| 79 20 74 68 65 0a 25 20 | 64 69 6d 65 6e 73 69 6f |y the.% |dimensio|
|00001d40| 6e 20 70 61 72 74 20 28 | 69 2e 65 2e 2c 20 74 68 |n part (|i.e., th|
|00001d50| 65 20 70 61 72 74 20 77 | 69 74 68 20 74 68 65 20 |e part w|ith the |
|00001d60| 75 6e 69 74 20 64 65 73 | 69 67 6e 61 74 69 6f 6e |unit des|ignation|
|00001d70| 29 20 6d 75 73 74 20 63 | 6f 6d 65 0a 25 20 66 69 |) must c|ome.% fi|
|00001d80| 72 73 74 3b 20 5c 54 65 | 58 5c 20 73 69 6d 70 6c |rst; \Te|X\ simpl|
|00001d90| 79 20 64 6f 65 73 6e 27 | 74 20 61 6c 6c 6f 77 20 |y doesn'|t allow |
|00001da0| 75 6e 74 79 70 65 64 20 | 63 6f 6e 73 74 61 6e 74 |untyped |constant|
|00001db0| 73 20 74 6f 20 62 65 20 | 61 73 73 69 67 6e 65 64 |s to be |assigned|
|00001dc0| 0a 25 20 74 6f 20 61 20 | 64 69 6d 65 6e 20 72 65 |.% to a |dimen re|
|00001dd0| 67 69 73 74 65 72 2e 0a | 25 0a 25 20 54 68 65 20 |gister..|%.% The |
|00001de0| 5c 74 65 78 74 74 74 7b | 63 61 6c 63 7d 20 70 61 |\texttt{|calc} pa|
|00001df0| 63 6b 61 67 65 20 61 6c | 73 6f 20 61 6c 6c 6f 77 |ckage al|so allow|
|00001e00| 73 20 6d 75 6c 74 69 70 | 6c 69 63 61 74 69 6f 6e |s multip|lication|
|00001e10| 20 61 6e 64 20 64 69 76 | 69 73 69 6f 6e 20 62 79 | and div|ision by|
|00001e20| 0a 25 20 72 65 61 6c 20 | 6e 75 6d 62 65 72 73 2e |.% real |numbers.|
|00001e30| 20 20 48 6f 77 65 76 65 | 72 2c 20 61 20 73 70 65 | Howeve|r, a spe|
|00001e40| 63 69 61 6c 20 73 79 6e | 74 61 78 20 69 73 20 72 |cial syn|tax is r|
|00001e50| 65 71 75 69 72 65 64 3a | 20 79 6f 75 20 6d 75 73 |equired:| you mus|
|00001e60| 74 20 75 73 65 0a 25 20 | 7c 5c 72 65 61 6c 7b 7c |t use.% ||\real{||
|00001e70| 5c 3c 64 65 63 69 6d 61 | 6c 20 63 6f 6e 73 74 61 |\<decima|l consta|
|00001e80| 6e 74 3e 7c 7d 7c 5c 66 | 6f 6f 74 6e 6f 74 65 7b |nt>|}|\f|ootnote{|
|00001e90| 41 63 74 75 61 6c 6c 79 | 2c 20 69 6e 73 74 65 61 |Actually|, instea|
|00001ea0| 64 20 6f 66 0a 25 20 5c | 3c 64 65 63 69 6d 61 6c |d of.% \|<decimal|
|00001eb0| 20 63 6f 6e 73 74 61 6e | 74 3e 2c 20 74 68 65 20 | constan|t>, the |
|00001ec0| 6d 6f 72 65 20 67 65 6e | 65 72 61 6c 20 5c 3c 6f |more gen|eral \<o|
|00001ed0| 70 74 69 6f 6e 61 6c 20 | 73 69 67 6e 73 3e 5c 3c |ptional |signs>\<|
|00001ee0| 66 61 63 74 6f 72 3e 20 | 63 61 6e 0a 25 20 62 65 |factor> |can.% be|
|00001ef0| 20 75 73 65 64 2e 20 20 | 48 6f 77 65 76 65 72 2c | used. |However,|
|00001f00| 20 74 68 61 74 20 64 6f | 65 73 6e 27 74 20 61 64 | that do|esn't ad|
|00001f10| 64 20 61 6e 79 20 65 78 | 74 72 61 20 65 78 70 72 |d any ex|tra expr|
|00001f20| 65 73 73 69 76 65 20 70 | 6f 77 65 72 20 74 6f 0a |essive p|ower to.|
|00001f30| 25 20 74 68 65 20 6c 61 | 6e 67 75 61 67 65 20 6f |% the la|nguage o|
|00001f40| 66 20 69 6e 66 69 78 20 | 65 78 70 72 65 73 73 69 |f infix |expressi|
|00001f50| 6f 6e 73 2e 7d 20 6f 72 | 0a 25 20 7c 5c 72 61 74 |ons.} or|.% |\rat|
|00001f60| 69 6f 7b 7c 5c 3c 64 69 | 6d 65 6e 20 65 78 70 72 |io{|\<di|men expr|
|00001f70| 65 73 73 69 6f 6e 3e 7c | 7d 7b 7c 5c 3c 64 69 6d |ession>||}{|\<dim|
|00001f80| 65 6e 20 65 78 70 72 65 | 73 73 69 6f 6e 3e 7c 7d |en expre|ssion>|}|
|00001f90| 7c 20 74 6f 20 64 65 6e | 6f 74 65 20 61 0a 25 20 || to den|ote a.% |
|00001fa0| 72 65 61 6c 20 76 61 6c | 75 65 20 74 6f 20 62 65 |real val|ue to be|
|00001fb0| 20 75 73 65 64 20 66 6f | 72 20 6d 75 6c 74 69 70 | used fo|r multip|
|00001fc0| 6c 69 63 61 74 69 6f 6e | 2f 64 69 76 69 73 69 6f |lication|/divisio|
|00001fd0| 6e 2e 20 20 54 68 65 20 | 66 69 72 73 74 20 66 6f |n. The |first fo|
|00001fe0| 72 6d 20 68 61 73 0a 25 | 20 74 68 65 20 6f 62 76 |rm has.%| the obv|
|00001ff0| 69 6f 75 73 20 6d 65 61 | 6e 69 6e 67 2c 20 61 6e |ious mea|ning, an|
|00002000| 64 20 74 68 65 20 73 65 | 63 6f 6e 64 20 66 6f 72 |d the se|cond for|
|00002010| 6d 20 64 65 6e 6f 74 65 | 73 20 74 68 65 20 6e 75 |m denote|s the nu|
|00002020| 6d 62 65 72 20 6f 62 74 | 61 69 6e 65 64 0a 25 20 |mber obt|ained.% |
|00002030| 62 79 20 64 69 76 69 64 | 69 6e 67 20 74 68 65 20 |by divid|ing the |
|00002040| 76 61 6c 75 65 20 6f 66 | 20 74 68 65 20 66 69 72 |value of| the fir|
|00002050| 73 74 20 65 78 70 72 65 | 73 73 69 6f 6e 20 62 79 |st expre|ssion by|
|00002060| 20 74 68 65 20 76 61 6c | 75 65 20 6f 66 20 74 68 | the val|ue of th|
|00002070| 65 0a 25 20 73 65 63 6f | 6e 64 20 65 78 70 72 65 |e.% seco|nd expre|
|00002080| 73 73 69 6f 6e 2e 20 0a | 25 0a 25 20 5c 54 65 58 |ssion. .|%.% \TeX|
|00002090| 5c 20 64 69 73 63 61 72 | 64 73 20 74 68 65 20 73 |\ discar|ds the s|
|000020a0| 74 72 65 74 63 68 20 61 | 6e 64 20 73 68 72 69 6e |tretch a|nd shrin|
|000020b0| 6b 20 63 6f 6d 70 6f 6e | 65 6e 74 73 20 6f 66 20 |k compon|ents of |
|000020c0| 67 6c 75 65 20 77 68 65 | 6e 20 67 6c 75 65 0a 25 |glue whe|n glue.%|
|000020d0| 20 69 73 20 6d 75 6c 74 | 69 70 6c 69 65 64 20 62 | is mult|iplied b|
|000020e0| 79 20 61 20 72 65 61 6c | 20 6e 75 6d 62 65 72 2e |y a real| number.|
|000020f0| 20 20 53 6f 2c 20 66 6f | 72 20 65 78 61 6d 70 6c | So, fo|r exampl|
|00002100| 65 2c 0a 25 5c 62 65 67 | 69 6e 7b 76 65 72 62 61 |e,.%\beg|in{verba|
|00002110| 74 69 6d 7d 0a 25 20 20 | 20 20 5c 73 65 74 6c 65 |tim}.% | \setle|
|00002120| 6e 67 74 68 7b 5c 70 61 | 72 73 6b 69 70 7d 7b 33 |ngth{\pa|rskip}{3|
|00002130| 70 74 20 70 6c 75 73 20 | 33 70 74 20 2a 20 5c 72 |pt plus |3pt * \r|
|00002140| 65 61 6c 7b 31 2e 35 7d | 7d 0a 25 5c 65 6e 64 7b |eal{1.5}|}.%\end{|
|00002150| 76 65 72 62 61 74 69 6d | 7d 0a 25 20 77 69 6c 6c |verbatim|}.% will|
|00002160| 20 73 65 74 20 74 68 65 | 20 70 61 72 61 67 72 61 | set the| paragra|
|00002170| 70 68 20 73 65 70 61 72 | 61 74 69 6f 6e 20 74 6f |ph separ|ation to|
|00002180| 20 34 2e 35 70 74 20 77 | 69 74 68 20 6e 6f 20 73 | 4.5pt w|ith no s|
|00002190| 74 72 65 74 63 68 20 6f | 72 0a 25 20 73 68 72 69 |tretch o|r.% shri|
|000021a0| 6e 6b 2e 20 20 28 49 6e | 63 69 64 65 6e 74 61 6c |nk. (In|cidental|
|000021b0| 6c 79 2c 20 6e 6f 74 65 | 20 68 6f 77 20 73 70 61 |ly, note| how spa|
|000021c0| 63 65 73 20 63 61 6e 20 | 62 65 20 75 73 65 64 20 |ces can |be used |
|000021d0| 74 6f 20 65 6e 68 61 6e | 63 65 0a 25 20 72 65 61 |to enhan|ce.% rea|
|000021e0| 64 61 62 69 6c 69 74 79 | 2e 29 0a 25 0a 25 20 57 |dability|.).%.% W|
|000021f0| 68 65 6e 20 5c 54 65 58 | 5c 20 70 65 72 66 6f 72 |hen \TeX|\ perfor|
|00002200| 6d 73 20 61 72 69 74 68 | 6d 65 74 69 63 20 6f 6e |ms arith|metic on|
|00002210| 20 69 6e 74 65 67 65 72 | 73 2c 20 61 6e 79 20 66 | integer|s, any f|
|00002220| 72 61 63 74 69 6f 6e 61 | 6c 20 70 61 72 74 20 6f |ractiona|l part o|
|00002230| 66 0a 25 20 74 68 65 20 | 72 65 73 75 6c 74 73 20 |f.% the |results |
|00002240| 61 72 65 20 64 69 73 63 | 61 72 64 65 64 2e 20 20 |are disc|arded. |
|00002250| 46 6f 72 20 65 78 61 6d | 70 6c 65 2c 0a 25 5c 62 |For exam|ple,.%\b|
|00002260| 65 67 69 6e 7b 76 65 72 | 62 61 74 69 6d 7d 0a 25 |egin{ver|batim}.%|
|00002270| 20 20 20 20 5c 73 65 74 | 63 6f 75 6e 74 65 72 7b | \set|counter{|
|00002280| 78 7d 7b 37 2f 32 7d 0a | 25 20 20 20 20 5c 73 65 |x}{7/2}.|% \se|
|00002290| 74 63 6f 75 6e 74 65 72 | 7b 79 7d 7b 33 2a 5c 72 |tcounter|{y}{3*\r|
|000022a0| 65 61 6c 7b 31 2e 36 7d | 7d 0a 25 20 20 20 20 5c |eal{1.6}|}.% \|
|000022b0| 73 65 74 63 6f 75 6e 74 | 65 72 7b 7a 7d 7b 33 2a |setcount|er{z}{3*|
|000022c0| 5c 72 65 61 6c 7b 31 2e | 37 7d 7d 0a 25 5c 65 6e |\real{1.|7}}.%\en|
|000022d0| 64 7b 76 65 72 62 61 74 | 69 6d 7d 0a 25 20 77 69 |d{verbat|im}.% wi|
|000022e0| 6c 6c 20 61 73 73 69 67 | 6e 20 74 68 65 20 76 61 |ll assig|n the va|
|000022f0| 6c 75 65 7e 24 33 24 20 | 74 6f 20 74 68 65 20 63 |lue~$3$ |to the c|
|00002300| 6f 75 6e 74 65 72 7e 5c | 74 65 78 74 74 74 7b 78 |ounter~\|texttt{x|
|00002310| 7d 2c 20 74 68 65 20 76 | 61 6c 75 65 7e 24 34 24 |}, the v|alue~$4$|
|00002320| 0a 25 20 74 6f 7e 5c 74 | 65 78 74 74 74 7b 79 7d |.% to~\t|exttt{y}|
|00002330| 2c 20 61 6e 64 20 74 68 | 65 20 76 61 6c 75 65 7e |, and th|e value~|
|00002340| 24 35 24 20 74 6f 7e 5c | 74 65 78 74 74 74 7b 7a |$5$ to~\|texttt{z|
|00002350| 7d 2e 20 20 54 68 69 73 | 20 74 72 75 6e 63 61 74 |}. This| truncat|
|00002360| 69 6f 6e 0a 25 20 61 6c | 73 6f 20 61 70 70 6c 69 |ion.% al|so appli|
|00002370| 65 73 20 74 6f 20 5c 65 | 6d 70 68 7b 69 6e 74 65 |es to \e|mph{inte|
|00002380| 72 6d 65 64 69 61 74 65 | 7d 20 72 65 73 75 6c 74 |rmediate|} result|
|00002390| 73 20 69 6e 20 74 68 65 | 20 73 65 71 75 65 6e 74 |s in the| sequent|
|000023a0| 69 61 6c 0a 25 20 63 6f | 6d 70 75 74 61 74 69 6f |ial.% co|mputatio|
|000023b0| 6e 20 6f 66 20 61 20 63 | 6f 6d 70 6f 73 69 74 65 |n of a c|omposite|
|000023c0| 20 65 78 70 72 65 73 73 | 69 6f 6e 3b 20 74 68 75 | express|ion; thu|
|000023d0| 73 2c 20 74 68 65 20 66 | 6f 6c 6c 6f 77 69 6e 67 |s, the f|ollowing|
|000023e0| 20 63 6f 6d 6d 61 6e 64 | 0a 25 5c 62 65 67 69 6e | command|.%\begin|
|000023f0| 7b 76 65 72 62 61 74 69 | 6d 7d 0a 25 20 20 20 20 |{verbati|m}.% |
|00002400| 5c 73 65 74 63 6f 75 6e | 74 65 72 7b 78 7d 7b 33 |\setcoun|ter{x}{3|
|00002410| 20 2a 20 5c 72 65 61 6c | 7b 31 2e 36 7d 20 2a 20 | * \real|{1.6} * |
|00002420| 5c 72 65 61 6c 7b 31 2e | 37 7d 7d 0a 25 5c 65 6e |\real{1.|7}}.%\en|
|00002430| 64 7b 76 65 72 62 61 74 | 69 6d 7d 0a 25 20 77 69 |d{verbat|im}.% wi|
|00002440| 6c 6c 20 61 73 73 69 67 | 6e 7e 24 36 24 20 74 6f |ll assig|n~$6$ to|
|00002450| 7e 5c 74 65 78 74 74 74 | 7b 78 7d 2e 0a 25 0a 25 |~\texttt|{x}..%.%|
|00002460| 20 41 73 20 61 6e 20 65 | 78 61 6d 70 6c 65 20 6f | As an e|xample o|
|00002470| 66 20 74 68 65 20 75 73 | 65 20 6f 66 20 7c 5c 72 |f the us|e of |\r|
|00002480| 61 74 69 6f 7c 2c 20 63 | 6f 6e 73 69 64 65 72 20 |atio|, c|onsider |
|00002490| 74 68 65 20 70 72 6f 62 | 6c 65 6d 20 6f 66 0a 25 |the prob|lem of.%|
|000024a0| 20 73 63 61 6c 69 6e 67 | 20 61 20 66 69 67 75 72 | scaling| a figur|
|000024b0| 65 20 74 6f 20 6f 63 63 | 75 70 79 20 74 68 65 20 |e to occ|upy the |
|000024c0| 66 75 6c 6c 20 77 69 64 | 74 68 20 28 69 2e 65 2e |full wid|th (i.e.|
|000024d0| 2c 20 7c 5c 74 65 78 74 | 77 69 64 74 68 7c 29 20 |, |\text|width|) |
|000024e0| 6f 66 0a 25 20 74 68 65 | 20 62 6f 64 79 20 6f 66 |of.% the| body of|
|000024f0| 20 61 20 70 61 67 65 2e | 20 20 41 73 73 75 6d 65 | a page.| Assume|
|00002500| 20 74 68 61 74 20 74 68 | 65 20 6f 72 69 67 69 6e | that th|e origin|
|00002510| 61 6c 20 64 69 6d 65 6e | 73 69 6f 6e 73 20 6f 66 |al dimen|sions of|
|00002520| 20 74 68 65 0a 25 20 66 | 69 67 75 72 65 20 61 72 | the.% f|igure ar|
|00002530| 65 20 67 69 76 65 6e 20 | 62 79 20 74 68 65 20 64 |e given |by the d|
|00002540| 69 6d 65 6e 20 28 6c 65 | 6e 67 74 68 29 20 76 61 |imen (le|ngth) va|
|00002550| 72 69 61 62 6c 65 73 2c | 20 7c 5c 58 73 69 7a 65 |riables,| |\Xsize|
|00002560| 7c 20 61 6e 64 0a 25 20 | 7c 5c 59 73 69 7a 65 7c || and.% ||\Ysize||
|00002570| 2e 20 20 54 68 65 20 68 | 65 69 67 68 74 20 6f 66 |. The h|eight of|
|00002580| 20 74 68 65 20 73 63 61 | 6c 65 64 20 66 69 67 75 | the sca|led figu|
|00002590| 72 65 20 63 61 6e 20 74 | 68 65 6e 20 62 65 20 65 |re can t|hen be e|
|000025a0| 78 70 72 65 73 73 65 64 | 20 62 79 0a 25 5c 62 65 |xpressed| by.%\be|
|000025b0| 67 69 6e 7b 76 65 72 62 | 61 74 69 6d 7d 0a 25 20 |gin{verb|atim}.% |
|000025c0| 20 20 20 5c 73 65 74 6c | 65 6e 67 74 68 7b 5c 6e | \setl|ength{\n|
|000025d0| 65 77 59 73 69 7a 65 7d | 7b 5c 59 73 69 7a 65 2a |ewYsize}|{\Ysize*|
|000025e0| 5c 72 61 74 69 6f 7b 5c | 74 65 78 74 77 69 64 74 |\ratio{\|textwidt|
|000025f0| 68 7d 7b 5c 58 73 69 7a | 65 7d 7d 0a 25 5c 65 6e |h}{\Xsiz|e}}.%\en|
|00002600| 64 7b 76 65 72 62 61 74 | 69 6d 7d 0a 25 0a 25 20 |d{verbat|im}.%.% |
|00002610| 5c 73 65 63 74 69 6f 6e | 7b 46 6f 72 6d 61 6c 20 |\section|{Formal |
|00002620| 73 79 6e 74 61 78 7d 0a | 25 0a 25 20 54 68 65 20 |syntax}.|%.% The |
|00002630| 73 79 6e 74 61 78 20 69 | 73 20 64 65 73 63 72 69 |syntax i|s descri|
|00002640| 62 65 64 20 62 79 20 74 | 68 65 20 66 6f 6c 6c 6f |bed by t|he follo|
|00002650| 77 69 6e 67 20 73 65 74 | 20 6f 66 20 72 75 6c 65 |wing set| of rule|
|00002660| 73 2e 0a 25 20 4e 6f 74 | 65 20 74 68 61 74 20 74 |s..% Not|e that t|
|00002670| 68 65 20 64 65 66 69 6e | 69 74 69 6f 6e 73 20 6f |he defin|itions o|
|00002680| 66 20 5c 3c 6e 75 6d 62 | 65 72 3e 2c 20 5c 3c 64 |f \<numb|er>, \<d|
|00002690| 69 6d 65 6e 3e 2c 20 5c | 3c 67 6c 75 65 3e 2c 0a |imen>, \|<glue>,.|
|000026a0| 25 20 5c 3c 64 65 63 69 | 6d 61 6c 20 63 6f 6e 73 |% \<deci|mal cons|
|000026b0| 74 61 6e 74 3e 2c 20 61 | 6e 64 20 5c 3c 70 6c 75 |tant>, a|nd \<plu|
|000026c0| 73 20 6f 72 20 6d 69 6e | 75 73 3e 20 61 72 65 0a |s or min|us> are.|
|000026d0| 25 20 64 65 66 69 6e 65 | 64 20 69 6e 20 43 68 61 |% define|d in Cha|
|000026e0| 70 74 65 72 7e 32 34 20 | 6f 66 20 54 68 65 20 5c |pter~24 |of The \|
|000026f0| 54 65 58 20 62 6f 6f 6b | 7e 5c 63 69 74 65 7b 74 |TeX book|~\cite{t|
|00002700| 65 78 62 6f 6f 6b 7d 2e | 0a 25 20 57 65 20 75 73 |exbook}.|.% We us|
|00002710| 65 20 5c 74 65 78 74 69 | 74 7b 74 79 70 65 7d 20 |e \texti|t{type} |
|00002720| 61 73 20 61 20 6d 65 74 | 61 2d 76 65 72 69 61 62 |as a met|a-veriab|
|00002730| 6c 65 2c 20 73 74 61 6e | 64 69 6e 67 20 66 6f 72 |le, stan|ding for|
|00002740| 0a 25 20 60 69 6e 74 65 | 67 65 72 27 2c 20 60 64 |.% `inte|ger', `d|
|00002750| 69 6d 65 6e 27 2c 20 61 | 6e 64 20 60 67 6c 75 65 |imen', a|nd `glue|
|00002760| 27 2e 5c 66 6f 6f 74 6e | 6f 74 65 7b 54 68 69 73 |'.\footn|ote{This|
|00002770| 20 76 65 72 73 69 6f 6e | 20 6f 66 20 74 68 65 0a | version| of the.|
|00002780| 25 20 5c 74 65 78 74 74 | 74 7b 63 61 6c 63 7d 20 |% \textt|t{calc} |
|00002790| 70 61 63 6b 61 67 65 20 | 64 6f 65 73 6e 27 74 20 |package |doesn't |
|000027a0| 73 75 70 70 6f 72 74 20 | 65 76 61 6c 75 61 74 69 |support |evaluati|
|000027b0| 6f 6e 20 6f 66 20 6d 75 | 67 6c 75 65 20 65 78 70 |on of mu|glue exp|
|000027c0| 72 65 73 73 69 6f 6e 73 | 2e 7d 0a 25 20 5c 62 65 |ressions|.}.% \be|
|000027d0| 67 69 6e 7b 63 61 6c 63 | 2d 73 79 6e 74 61 78 7d |gin{calc|-syntax}|
|000027e0| 0a 25 20 20 20 20 5c 3c | 5c 74 65 78 74 69 74 7b |.% \<|\textit{|
|000027f0| 74 79 70 65 7d 20 65 78 | 70 72 65 73 73 69 6f 6e |type} ex|pression|
|00002800| 3e 0a 25 20 20 20 20 20 | 20 20 5c 69 73 20 20 5c |>.% | \is \|
|00002810| 3c 5c 74 65 78 74 69 74 | 7b 74 79 70 65 7d 20 74 |<\textit|{type} t|
|00002820| 65 72 6d 3e 0a 25 20 20 | 20 20 20 20 20 5c 61 6c |erm>.% | \al|
|00002830| 74 20 5c 3c 5c 74 65 78 | 74 69 74 7b 74 79 70 65 |t \<\tex|tit{type|
|00002840| 7d 20 65 78 70 72 65 73 | 73 69 6f 6e 3e 20 5c 3c |} expres|sion> \<|
|00002850| 70 6c 75 73 20 6f 72 20 | 6d 69 6e 75 73 3e 20 5c |plus or |minus> \|
|00002860| 3c 5c 74 65 78 74 69 74 | 7b 74 79 70 65 7d 20 74 |<\textit|{type} t|
|00002870| 65 72 6d 3e 0a 25 0a 25 | 20 20 20 20 5c 3c 5c 74 |erm>.%.%| \<\t|
|00002880| 65 78 74 69 74 7b 74 79 | 70 65 7d 20 74 65 72 6d |extit{ty|pe} term|
|00002890| 3e 0a 25 20 20 20 20 20 | 20 20 5c 69 73 20 20 5c |>.% | \is \|
|000028a0| 3c 5c 74 65 78 74 69 74 | 7b 74 79 70 65 7d 20 66 |<\textit|{type} f|
|000028b0| 61 63 74 6f 72 3e 0a 25 | 20 20 20 20 20 20 20 5c |actor>.%| \|
|000028c0| 61 6c 74 20 5c 3c 5c 74 | 65 78 74 69 74 7b 74 79 |alt \<\t|extit{ty|
|000028d0| 70 65 7d 20 74 65 72 6d | 3e 20 5c 3c 6d 75 6c 74 |pe} term|> \<mult|
|000028e0| 69 70 6c 79 20 6f 72 20 | 64 69 76 69 64 65 3e 20 |iply or |divide> |
|000028f0| 5c 3c 69 6e 74 65 67 65 | 72 20 66 61 63 74 6f 72 |\<intege|r factor|
|00002900| 3e 0a 25 20 20 20 20 20 | 20 20 5c 61 6c 74 20 5c |>.% | \alt \|
|00002910| 3c 5c 74 65 78 74 69 74 | 7b 74 79 70 65 7d 20 74 |<\textit|{type} t|
|00002920| 65 72 6d 3e 20 5c 3c 6d | 75 6c 74 69 70 6c 79 20 |erm> \<m|ultiply |
|00002930| 6f 72 20 64 69 76 69 64 | 65 3e 20 5c 3c 72 65 61 |or divid|e> \<rea|
|00002940| 6c 20 6e 75 6d 62 65 72 | 3e 0a 25 0a 25 20 20 20 |l number|>.%.% |
|00002950| 20 5c 3c 5c 74 65 78 74 | 69 74 7b 74 79 70 65 7d | \<\text|it{type}|
|00002960| 20 66 61 63 74 6f 72 3e | 0a 25 20 20 20 20 20 20 | factor>|.% |
|00002970| 20 5c 69 73 20 20 5c 3c | 5c 74 65 78 74 69 74 7b | \is \<|\textit{|
|00002980| 74 79 70 65 7d 3e 0a 25 | 20 20 20 20 20 20 20 5c |type}>.%| \|
|00002990| 61 6c 74 20 7c 28 7c 24 | 5f 7b 31 32 7d 24 20 5c |alt |(|$|_{12}$ \|
|000029a0| 3c 5c 74 65 78 74 69 74 | 7b 74 79 70 65 7d 20 65 |<\textit|{type} e|
|000029b0| 78 70 72 65 73 73 69 6f | 6e 3e 20 7c 29 7c 24 5f |xpressio|n> |)|$_|
|000029c0| 7b 31 32 7d 24 0a 25 0a | 25 20 20 20 20 5c 3c 69 |{12}$.%.|% \<i|
|000029d0| 6e 74 65 67 65 72 3e 20 | 5c 69 73 20 5c 3c 6e 75 |nteger> |\is \<nu|
|000029e0| 6d 62 65 72 3e 0a 25 0a | 25 20 20 20 20 5c 3c 6d |mber>.%.|% \<m|
|000029f0| 75 6c 74 69 70 6c 79 20 | 6f 72 20 64 69 76 69 64 |ultiply |or divid|
|00002a00| 65 3e 0a 25 20 20 20 20 | 20 20 20 5c 69 73 20 20 |e>.% | \is |
|00002a10| 7c 2a 7c 24 5f 7b 31 32 | 7d 24 0a 25 20 20 20 20 ||*|$_{12|}$.% |
|00002a20| 20 20 20 5c 61 6c 74 20 | 7c 2f 7c 24 5f 7b 31 32 | \alt ||/|$_{12|
|00002a30| 7d 24 0a 25 0a 25 20 20 | 20 20 5c 3c 72 65 61 6c |}$.%.% | \<real|
|00002a40| 20 6e 75 6d 62 65 72 3e | 0a 25 20 20 20 20 20 20 | number>|.% |
|00002a50| 20 5c 69 73 20 20 7c 5c | 72 61 74 69 6f 7b 7c 20 | \is |\|ratio{| |
|00002a60| 5c 3c 64 69 6d 65 6e 20 | 65 78 70 72 65 73 73 69 |\<dimen |expressi|
|00002a70| 6f 6e 3e 20 7c 7d 7b 7c | 20 5c 3c 64 69 6d 65 6e |on> |}{|| \<dimen|
|00002a80| 20 65 78 70 72 65 73 73 | 69 6f 6e 3e 20 7c 7d 7c | express|ion> |}||
|00002a90| 0a 25 20 20 20 20 20 20 | 20 5c 61 6c 74 20 7c 5c |.% | \alt |\|
|00002aa0| 72 65 61 6c 7b 7c 20 20 | 5c 3c 64 65 63 69 6d 61 |real{| |\<decima|
|00002ab0| 6c 20 63 6f 6e 73 74 61 | 6e 74 3e 20 7c 7d 7c 0a |l consta|nt> |}|.|
|00002ac0| 25 20 5c 65 6e 64 7b 63 | 61 6c 63 2d 73 79 6e 74 |% \end{c|alc-synt|
|00002ad0| 61 78 7d 0a 25 0a 25 20 | 5c 53 74 6f 70 45 76 65 |ax}.%.% |\StopEve|
|00002ae0| 6e 74 75 61 6c 6c 79 7b | 0a 25 20 5c 62 65 67 69 |ntually{|.% \begi|
|00002af0| 6e 7b 74 68 65 62 69 62 | 6c 69 6f 67 72 61 70 68 |n{thebib|liograph|
|00002b00| 79 7d 7b 31 7d 0a 25 20 | 20 20 20 5c 62 69 62 69 |y}{1}.% | \bibi|
|00002b10| 74 65 6d 7b 74 65 78 62 | 6f 6f 6b 7d 0a 25 20 20 |tem{texb|ook}.% |
|00002b20| 20 20 20 20 20 5c 74 65 | 78 74 73 63 7b 44 2e 20 | \te|xtsc{D. |
|00002b30| 45 2e 20 4b 6e 75 74 68 | 7d 2e 0a 25 20 20 20 20 |E. Knuth|}..% |
|00002b40| 20 20 20 5c 6e 65 77 62 | 6c 6f 63 6b 20 5c 74 65 | \newb|lock \te|
|00002b50| 78 74 69 74 7b 54 68 65 | 20 5c 54 65 58 7b 7d 62 |xtit{The| \TeX{}b|
|00002b60| 6f 6f 6b 7d 20 28 43 6f | 6d 70 75 74 65 72 73 20 |ook} (Co|mputers |
|00002b70| 5c 26 20 54 79 70 65 73 | 65 74 74 69 6e 67 20 56 |\& Types|etting V|
|00002b80| 6f 6c 75 6d 65 20 41 29 | 2e 0a 25 20 20 20 20 20 |olume A)|..% |
|00002b90| 20 20 5c 6e 65 77 62 6c | 6f 63 6b 20 41 64 64 69 | \newbl|ock Addi|
|00002ba0| 73 6f 6e 2d 57 65 73 6c | 65 79 2c 20 52 65 61 64 |son-Wesl|ey, Read|
|00002bb0| 69 6e 67 2c 20 4d 61 73 | 73 61 63 68 75 73 65 74 |ing, Mas|sachuset|
|00002bc0| 74 73 2c 20 31 39 38 36 | 2e 0a 25 20 20 20 20 5c |ts, 1986|..% \|
|00002bd0| 62 69 62 69 74 65 6d 7b | 6c 61 74 65 78 6d 61 6e |bibitem{|latexman|
|00002be0| 7d 0a 25 20 20 20 20 20 | 20 20 5c 74 65 78 74 73 |}.% | \texts|
|00002bf0| 63 7b 4c 2e 20 4c 61 6d | 70 6f 72 74 7d 2e 0a 25 |c{L. Lam|port}..%|
|00002c00| 20 20 20 20 20 20 20 5c | 6e 65 77 62 6c 6f 63 6b | \|newblock|
|00002c10| 20 5c 74 65 78 74 69 74 | 7b 5c 4c 61 54 65 58 2c | \textit|{\LaTeX,|
|00002c20| 20 41 20 44 6f 63 75 6d | 65 6e 74 20 50 72 65 70 | A Docum|ent Prep|
|00002c30| 61 72 61 74 69 6f 6e 20 | 53 79 73 74 65 6d 2e 7d |aration |System.}|
|00002c40| 0a 25 20 20 20 20 20 20 | 20 5c 6e 65 77 62 6c 6f |.% | \newblo|
|00002c50| 63 6b 20 41 64 64 69 73 | 6f 6e 2d 57 65 73 6c 65 |ck Addis|on-Wesle|
|00002c60| 79 2c 20 52 65 61 64 69 | 6e 67 2c 20 4d 61 73 73 |y, Readi|ng, Mass|
|00002c70| 61 63 68 75 73 65 74 74 | 73 2c 20 53 65 63 6f 6e |achusett|s, Secon|
|00002c80| 64 0a 25 20 20 20 20 20 | 20 20 65 64 69 74 69 6f |d.% | editio|
|00002c90| 6e 20 31 39 39 34 2f 31 | 39 38 35 2e 0a 25 20 5c |n 1994/1|985..% \|
|00002ca0| 65 6e 64 7b 74 68 65 62 | 69 62 6c 69 6f 67 72 61 |end{theb|ibliogra|
|00002cb0| 70 68 79 7d 0a 25 20 7d | 0a 25 0a 25 20 5c 73 65 |phy}.% }|.%.% \se|
|00002cc0| 63 74 69 6f 6e 7b 54 68 | 65 20 65 76 61 6c 75 61 |ction{Th|e evalua|
|00002cd0| 74 69 6f 6e 20 73 63 68 | 65 6d 65 7d 0a 25 20 5c |tion sch|eme}.% \|
|00002ce0| 6c 61 62 65 6c 7b 65 76 | 61 6c 75 61 74 69 6f 6e |label{ev|aluation|
|00002cf0| 3a 73 63 68 65 6d 65 7d | 0a 25 0a 25 20 49 6e 20 |:scheme}|.%.% In |
|00002d00| 74 68 69 73 20 73 65 63 | 74 69 6f 6e 2c 20 77 65 |this sec|tion, we|
|00002d10| 20 73 68 61 6c 6c 20 66 | 6f 72 20 73 69 6d 70 6c | shall f|or simpl|
|00002d20| 69 63 69 74 79 20 63 6f | 6e 73 69 64 65 72 20 6f |icity co|nsider o|
|00002d30| 6e 6c 79 20 65 78 70 72 | 65 73 73 69 6f 6e 73 0a |nly expr|essions.|
|00002d40| 25 20 63 6f 6e 74 61 69 | 6e 69 6e 67 20 60 24 2b |% contai|ning `$+|
|00002d50| 24 27 20 28 61 64 64 69 | 74 69 6f 6e 29 20 61 6e |$' (addi|tion) an|
|00002d60| 64 20 60 24 2a 24 27 20 | 28 6d 75 6c 74 69 70 6c |d `$*$' |(multipl|
|00002d70| 69 63 61 74 69 6f 6e 29 | 20 6f 70 65 72 61 74 6f |ication)| operato|
|00002d80| 72 73 2e 0a 25 20 49 74 | 20 69 73 20 74 72 69 76 |rs..% It| is triv|
|00002d90| 69 61 6c 20 74 6f 20 61 | 64 64 20 73 75 62 74 72 |ial to a|dd subtr|
|00002da0| 61 63 74 69 6f 6e 20 61 | 6e 64 20 64 69 76 69 73 |action a|nd divis|
|00002db0| 69 6f 6e 2e 0a 25 0a 25 | 20 41 6e 20 65 78 70 72 |ion..%.%| An expr|
|00002dc0| 65 73 73 69 6f 6e 20 24 | 45 24 20 69 73 20 61 20 |ession $|E$ is a |
|00002dd0| 73 75 6d 20 6f 66 20 74 | 65 72 6d 73 3a 20 24 54 |sum of t|erms: $T|
|00002de0| 5f 31 2b 5c 63 64 6f 74 | 73 2b 54 5f 6e 24 3b 20 |_1+\cdot|s+T_n$; |
|00002df0| 61 20 74 65 72 6d 20 69 | 73 20 61 0a 25 20 70 72 |a term i|s a.% pr|
|00002e00| 6f 64 75 63 74 20 6f 66 | 20 66 61 63 74 6f 72 73 |oduct of| factors|
|00002e10| 3a 20 24 46 5f 31 2a 5c | 63 64 6f 74 73 2a 46 5f |: $F_1*\|cdots*F_|
|00002e20| 6d 24 3b 20 61 20 66 61 | 63 74 6f 72 20 69 73 20 |m$; a fa|ctor is |
|00002e30| 65 69 74 68 65 72 20 61 | 20 73 69 6d 70 6c 65 0a |either a| simple.|
|00002e40| 25 20 6e 75 6d 65 72 69 | 63 20 71 75 61 6e 74 69 |% numeri|c quanti|
|00002e50| 74 79 7e 24 66 24 20 28 | 6c 69 6b 65 20 5c 3c 6e |ty~$f$ (|like \<n|
|00002e60| 75 6d 62 65 72 3e 20 61 | 73 20 64 65 73 63 72 69 |umber> a|s descri|
|00002e70| 62 65 64 20 69 6e 20 74 | 68 65 20 5c 54 65 58 20 |bed in t|he \TeX |
|00002e80| 62 6f 6f 6b 29 2c 0a 25 | 20 6f 72 20 61 20 70 61 |book),.%| or a pa|
|00002e90| 72 65 6e 74 68 65 73 69 | 7a 65 64 20 65 78 70 72 |renthesi|zed expr|
|00002ea0| 65 73 73 69 6f 6e 7e 24 | 28 45 27 29 24 2e 20 0a |ession~$|(E')$. .|
|00002eb0| 25 0a 25 20 53 69 6e 63 | 65 20 74 68 65 20 5c 54 |%.% Sinc|e the \T|
|00002ec0| 65 58 5c 20 65 6e 67 69 | 6e 65 20 63 61 6e 20 6f |eX\ engi|ne can o|
|00002ed0| 6e 6c 79 20 65 78 65 63 | 75 74 65 20 61 72 69 74 |nly exec|ute arit|
|00002ee0| 68 6d 65 74 69 63 20 6f | 70 65 72 61 74 69 6f 6e |hmetic o|peration|
|00002ef0| 73 20 69 6e 20 61 0a 25 | 20 6d 61 63 68 69 6e 65 |s in a.%| machine|
|00002f00| 2d 63 6f 64 65 20 6c 69 | 6b 65 20 6d 61 6e 6e 65 |-code li|ke manne|
|00002f10| 72 2c 20 77 65 20 68 61 | 76 65 20 74 6f 20 66 69 |r, we ha|ve to fi|
|00002f20| 6e 64 20 61 20 77 61 79 | 20 74 6f 20 74 72 61 6e |nd a way| to tran|
|00002f30| 73 6c 61 74 65 20 74 68 | 65 0a 25 20 69 6e 66 69 |slate th|e.% infi|
|00002f40| 78 20 6e 6f 74 61 74 69 | 6f 6e 20 69 6e 74 6f 20 |x notati|on into |
|00002f50| 74 68 69 73 20 60 69 6e | 73 74 72 75 63 74 69 6f |this `in|structio|
|00002f60| 6e 20 73 65 74 27 2e 0a | 25 0a 25 20 4f 75 72 20 |n set'..|%.% Our |
|00002f70| 67 6f 61 6c 20 69 73 20 | 74 6f 20 64 65 73 69 67 |goal is |to desig|
|00002f80| 6e 20 61 20 74 72 61 6e | 73 6c 61 74 69 6f 6e 20 |n a tran|slation |
|00002f90| 73 63 68 65 6d 65 20 74 | 68 61 74 20 74 72 61 6e |scheme t|hat tran|
|00002fa0| 73 6c 61 74 65 73 7e 24 | 58 24 20 28 61 6e 0a 25 |slates~$|X$ (an.%|
|00002fb0| 20 65 78 70 72 65 73 73 | 69 6f 6e 2c 20 61 20 74 | express|ion, a t|
|00002fc0| 65 72 6d 2c 20 6f 72 20 | 61 20 66 61 63 74 6f 72 |erm, or |a factor|
|00002fd0| 29 20 69 6e 74 6f 20 61 | 20 73 65 71 75 65 6e 63 |) into a| sequenc|
|00002fe0| 65 20 6f 66 20 5c 54 65 | 58 5c 20 69 6e 73 74 72 |e of \Te|X\ instr|
|00002ff0| 75 63 74 69 6f 6e 73 0a | 25 20 74 68 61 74 20 64 |uctions.|% that d|
|00003000| 6f 65 73 20 74 68 65 20 | 66 6f 6c 6c 6f 77 69 6e |oes the |followin|
|00003010| 67 20 5b 49 6e 76 61 72 | 69 61 6e 63 65 20 50 72 |g [Invar|iance Pr|
|00003020| 6f 70 65 72 74 79 5d 3a | 20 63 6f 72 72 65 63 74 |operty]:| correct|
|00003030| 6c 79 0a 25 20 65 76 61 | 6c 75 61 74 65 73 7e 24 |ly.% eva|luates~$|
|00003040| 58 24 2c 20 6c 65 61 76 | 65 73 20 74 68 65 20 72 |X$, leav|es the r|
|00003050| 65 73 75 6c 74 20 69 6e | 20 61 20 67 6c 6f 62 61 |esult in| a globa|
|00003060| 6c 20 72 65 67 69 73 74 | 65 72 7e 24 41 24 20 28 |l regist|er~$A$ (|
|00003070| 75 73 69 6e 67 20 61 0a | 25 20 67 6c 6f 62 61 6c |using a.|% global|
|00003080| 20 61 73 73 69 67 6e 6d | 65 6e 74 29 2c 20 61 6e | assignm|ent), an|
|00003090| 64 20 64 6f 65 73 20 6e | 6f 74 20 70 65 72 66 6f |d does n|ot perfo|
|000030a0| 72 6d 20 67 6c 6f 62 61 | 6c 20 61 73 73 69 67 6e |rm globa|l assign|
|000030b0| 6d 65 6e 74 73 20 74 6f | 20 74 68 65 0a 25 20 73 |ments to| the.% s|
|000030c0| 63 72 61 74 63 68 20 72 | 65 67 69 73 74 65 72 7e |cratch r|egister~|
|000030d0| 24 42 24 3b 20 6d 6f 72 | 65 6f 76 65 72 2c 20 74 |$B$; mor|eover, t|
|000030e0| 68 65 20 63 6f 64 65 20 | 73 65 71 75 65 6e 63 65 |he code |sequence|
|000030f0| 20 6d 75 73 74 20 62 65 | 20 62 61 6c 61 6e 63 65 | must be| balance|
|00003100| 64 0a 25 20 77 69 74 68 | 20 72 65 73 70 65 63 74 |d.% with| respect|
|00003110| 20 74 6f 20 5c 54 65 58 | 5c 20 67 72 6f 75 70 73 | to \TeX|\ groups|
|00003120| 2e 20 20 57 65 20 73 68 | 61 6c 6c 20 64 65 6e 6f |. We sh|all deno|
|00003130| 74 65 20 74 68 65 20 63 | 6f 64 65 20 73 65 71 75 |te the c|ode sequ|
|00003140| 65 6e 63 65 0a 25 20 63 | 6f 72 72 65 73 70 6f 6e |ence.% c|orrespon|
|00003150| 64 69 6e 67 20 74 6f 7e | 24 58 24 20 62 79 20 5c |ding to~|$X$ by \|
|00003160| 73 7b 58 7d 2e 0a 25 0a | 25 20 49 6e 20 74 68 65 |s{X}..%.|% In the|
|00003170| 20 72 65 70 6c 61 63 65 | 6d 65 6e 74 20 63 6f 64 | replace|ment cod|
|00003180| 65 20 73 70 65 63 69 66 | 69 65 64 20 62 65 6c 6f |e specif|ied belo|
|00003190| 77 2c 20 77 65 20 75 73 | 65 20 74 68 65 20 66 6f |w, we us|e the fo|
|000031a0| 6c 6c 6f 77 69 6e 67 0a | 25 20 63 6f 6e 76 65 6e |llowing.|% conven|
|000031b0| 74 69 6f 6e 73 3a 0a 25 | 20 5c 62 65 67 69 6e 7b |tions:.%| \begin{|
|000031c0| 69 74 65 6d 69 7a 65 7d | 0a 25 20 20 20 20 5c 69 |itemize}|.% \i|
|000031d0| 74 65 6d 20 24 41 24 20 | 61 6e 64 20 24 42 24 20 |tem $A$ |and $B$ |
|000031e0| 64 65 6e 6f 74 65 20 72 | 65 67 69 73 74 65 72 73 |denote r|egisters|
|000031f0| 3b 20 61 6c 6c 20 61 73 | 73 69 67 6e 6d 65 6e 74 |; all as|signment|
|00003200| 73 20 74 6f 7e 24 41 24 | 20 77 69 6c 6c 0a 25 20 |s to~$A$| will.% |
|00003210| 20 20 20 20 20 20 62 65 | 20 67 6c 6f 62 61 6c 2c | be| global,|
|00003220| 20 61 6e 64 20 61 6c 6c | 20 61 73 73 69 67 6e 6d | and all| assignm|
|00003230| 65 6e 74 73 20 74 6f 7e | 24 42 24 20 77 69 6c 6c |ents to~|$B$ will|
|00003240| 20 62 65 20 6c 6f 63 61 | 6c 2e 0a 25 20 20 20 20 | be loca|l..% |
|00003250| 5c 69 74 65 6d 20 60 60 | 24 5c 67 61 73 73 69 67 |\item ``|$\gassig|
|00003260| 6e 24 27 27 20 6d 65 61 | 6e 73 20 67 6c 6f 62 61 |n$'' mea|ns globa|
|00003270| 6c 20 61 73 73 69 67 6e | 6d 65 6e 74 20 74 6f 20 |l assign|ment to |
|00003280| 74 68 65 20 72 65 67 69 | 73 74 65 72 20 6f 6e 0a |the regi|ster on.|
|00003290| 25 20 20 20 20 20 20 20 | 74 68 65 20 6c 68 73 2e |% |the lhs.|
|000032a0| 0a 25 20 20 20 20 5c 69 | 74 65 6d 20 60 60 24 5c |.% \i|tem ``$\|
|000032b0| 6c 61 73 73 69 67 6e 20 | 24 27 27 20 6d 65 61 6e |lassign |$'' mean|
|000032c0| 73 20 6c 6f 63 61 6c 20 | 61 73 73 69 67 6e 6d 65 |s local |assignme|
|000032d0| 6e 74 20 74 6f 20 74 68 | 65 20 72 65 67 69 73 74 |nt to th|e regist|
|000032e0| 65 72 20 6f 6e 0a 25 20 | 20 20 20 20 20 20 74 68 |er on.% | th|
|000032f0| 65 20 6c 68 73 2e 0a 25 | 20 20 20 20 5c 69 74 65 |e lhs..%| \ite|
|00003300| 6d 20 60 60 5c 73 61 76 | 65 63 6f 64 65 20 43 27 |m ``\sav|ecode C'|
|00003310| 27 20 6d 65 61 6e 73 20 | 60 60 73 61 76 65 20 74 |' means |``save t|
|00003320| 68 65 20 63 6f 64 65 7e | 24 43 24 20 75 6e 74 69 |he code~|$C$ unti|
|00003330| 6c 20 74 68 65 20 63 75 | 72 72 65 6e 74 0a 25 20 |l the cu|rrent.% |
|00003340| 20 20 20 20 20 20 67 72 | 6f 75 70 20 28 73 63 6f | gr|oup (sco|
|00003350| 70 65 29 20 65 6e 64 73 | 2c 20 74 68 65 6e 20 65 |pe) ends|, then e|
|00003360| 78 65 63 75 74 65 20 69 | 74 2e 27 27 20 20 54 68 |xecute i|t.'' Th|
|00003370| 69 73 20 63 6f 72 72 65 | 73 70 6f 6e 64 73 20 74 |is corre|sponds t|
|00003380| 6f 0a 25 20 20 20 20 20 | 20 20 74 68 65 20 5c 54 |o.% | the \T|
|00003390| 65 58 2d 70 72 69 6d 69 | 74 69 76 65 20 7c 5c 61 |eX-primi|tive |\a|
|000033a0| 66 74 65 72 67 72 6f 75 | 70 7c 2e 0a 25 20 20 20 |ftergrou|p|..% |
|000033b0| 20 5c 69 74 65 6d 20 60 | 60 24 5c 7b 24 27 27 20 | \item `|`$\{$'' |
|000033c0| 64 65 6e 6f 74 65 73 20 | 74 68 65 20 73 74 61 72 |denotes |the star|
|000033d0| 74 20 6f 66 20 61 20 6e | 65 77 20 67 72 6f 75 70 |t of a n|ew group|
|000033e0| 2c 20 61 6e 64 20 60 60 | 24 5c 7d 24 27 27 0a 25 |, and ``|$\}$''.%|
|000033f0| 09 64 65 6e 6f 74 65 73 | 20 74 68 65 20 65 6e 64 |.denotes| the end|
|00003400| 20 6f 66 20 61 20 67 72 | 6f 75 70 2e 0a 25 20 5c | of a gr|oup..% \|
|00003410| 65 6e 64 7b 69 74 65 6d | 69 7a 65 7d 0a 25 0a 25 |end{item|ize}.%.%|
|00003420| 20 4c 65 74 20 75 73 20 | 63 6f 6e 73 69 64 65 72 | Let us |consider|
|00003430| 20 61 6e 20 65 78 70 72 | 65 73 73 69 6f 6e 20 24 | an expr|ession $|
|00003440| 54 5f 31 2b 54 5f 32 2b | 5c 63 64 6f 74 73 2b 54 |T_1+T_2+|\cdots+T|
|00003450| 5f 6e 24 2e 20 20 41 73 | 73 75 6d 69 6e 67 20 74 |_n$. As|suming t|
|00003460| 68 61 74 0a 25 20 5c 73 | 7b 54 5f 6b 7d 20 28 24 |hat.% \s|{T_k} ($|
|00003470| 31 5c 6c 65 20 6b 5c 6c | 65 20 6e 24 29 20 61 74 |1\le k\l|e n$) at|
|00003480| 74 61 69 6e 73 20 74 68 | 65 20 73 74 61 74 65 64 |tains th|e stated|
|00003490| 20 67 6f 61 6c 2c 20 74 | 68 65 20 66 6f 6c 6c 6f | goal, t|he follo|
|000034a0| 77 69 6e 67 20 63 6f 64 | 65 0a 25 20 63 6c 65 61 |wing cod|e.% clea|
|000034b0| 72 6c 79 20 61 74 74 61 | 69 6e 73 20 74 68 65 20 |rly atta|ins the |
|000034c0| 73 74 61 74 65 64 20 67 | 6f 61 6c 20 66 6f 72 20 |stated g|oal for |
|000034d0| 74 68 65 69 72 20 73 75 | 6d 3a 0a 25 20 5c 62 65 |their su|m:.% \be|
|000034e0| 67 69 6e 7b 65 71 6e 61 | 72 72 61 79 2a 7d 0a 25 |gin{eqna|rray*}.%|
|000034f0| 20 5c 73 7b 54 5f 31 2b | 54 5f 32 2b 5c 63 64 6f | \s{T_1+|T_2+\cdo|
|00003500| 74 73 2b 54 5f 6e 7d 26 | 5c 4c 6f 6e 67 72 69 67 |ts+T_n}&|\Longrig|
|00003510| 68 74 61 72 72 6f 77 26 | 0a 25 20 20 20 20 20 20 |htarrow&|.% |
|00003520| 20 5c 7b 5c 2c 5c 73 7b | 54 5f 31 7d 5c 2c 5c 7d | \{\,\s{|T_1}\,\}|
|00003530| 20 5c 3b 20 42 5c 6c 61 | 73 73 69 67 6e 20 41 20 | \; B\la|ssign A |
|00003540| 5c 71 75 61 64 0a 25 20 | 20 20 20 20 20 20 5c 7b |\quad.% | \{|
|00003550| 5c 2c 5c 73 7b 54 5f 32 | 7d 5c 2c 5c 7d 20 5c 3b |\,\s{T_2|}\,\} \;|
|00003560| 20 42 5c 6c 61 73 73 69 | 67 6e 20 42 2b 41 20 5c | B\lassi|gn B+A \|
|00003570| 5c 0a 25 20 20 20 20 20 | 20 20 26 26 5c 71 71 75 |\.% | &&\qqu|
|00003580| 61 64 20 5c 6c 64 6f 74 | 73 20 5c 71 75 61 64 20 |ad \ldot|s \quad |
|00003590| 5c 7b 5c 2c 5c 73 7b 54 | 5f 6e 7d 5c 2c 5c 7d 20 |\{\,\s{T|_n}\,\} |
|000035a0| 5c 3b 20 42 5c 6c 61 73 | 73 69 67 6e 20 42 2b 41 |\; B\las|sign B+A|
|000035b0| 0a 25 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |.% | |
|000035c0| 20 20 20 20 20 20 20 20 | 20 5c 71 75 61 64 20 41 | | \quad A|
|000035d0| 5c 67 61 73 73 69 67 6e | 20 42 0a 25 20 5c 65 6e |\gassign| B.% \en|
|000035e0| 64 7b 65 71 6e 61 72 72 | 61 79 2a 7d 0a 25 20 4e |d{eqnarr|ay*}.% N|
|000035f0| 6f 74 65 20 74 68 65 20 | 65 78 74 72 61 20 6c 65 |ote the |extra le|
|00003600| 76 65 6c 20 6f 66 20 67 | 72 6f 75 70 69 6e 67 20 |vel of g|rouping |
|00003610| 65 6e 63 6c 6f 73 69 6e | 67 20 65 61 63 68 20 6f |enclosin|g each o|
|00003620| 66 20 5c 73 7b 54 5f 31 | 7d 2c 20 5c 73 7b 54 5f |f \s{T_1|}, \s{T_|
|00003630| 32 7d 2c 0a 25 20 5c 6c | 64 6f 74 73 2c 7e 5c 73 |2},.% \l|dots,~\s|
|00003640| 7b 54 5f 6e 7d 2e 20 20 | 54 68 69 73 20 77 69 6c |{T_n}. |This wil|
|00003650| 6c 20 65 6e 73 75 72 65 | 20 74 68 61 74 20 72 65 |l ensure| that re|
|00003660| 67 69 73 74 65 72 7e 24 | 42 24 2c 20 75 73 65 64 |gister~$|B$, used|
|00003670| 20 74 6f 0a 25 20 63 6f | 6d 70 75 74 65 20 74 68 | to.% co|mpute th|
|00003680| 65 20 73 75 6d 20 6f 66 | 20 74 68 65 20 74 65 72 |e sum of| the ter|
|00003690| 6d 73 2c 20 69 73 20 6e | 6f 74 20 63 6c 6f 62 62 |ms, is n|ot clobb|
|000036a0| 65 72 65 64 20 62 79 20 | 74 68 65 20 69 6e 74 65 |ered by |the inte|
|000036b0| 72 6d 65 64 69 61 74 65 | 0a 25 20 63 6f 6d 70 75 |rmediate|.% compu|
|000036c0| 74 61 74 69 6f 6e 73 20 | 6f 66 20 74 68 65 20 69 |tations |of the i|
|000036d0| 6e 64 69 76 69 64 75 61 | 6c 20 74 65 72 6d 73 2e |ndividua|l terms.|
|000036e0| 20 20 41 63 74 75 61 6c | 6c 79 2c 20 74 68 65 20 | Actual|ly, the |
|000036f0| 67 72 6f 75 70 0a 25 20 | 65 6e 63 6c 6f 73 69 6e |group.% |enclosin|
|00003700| 67 7e 5c 73 7b 54 5f 31 | 7d 20 69 73 20 75 6e 6e |g~\s{T_1|} is unn|
|00003710| 65 63 65 73 73 61 72 79 | 2c 20 62 75 74 20 69 74 |ecessary|, but it|
|00003720| 20 74 75 72 6e 73 20 6f | 75 74 20 74 6f 20 62 65 | turns o|ut to be|
|00003730| 20 73 69 6d 70 6c 65 72 | 20 69 66 0a 25 20 61 6c | simpler| if.% al|
|00003740| 6c 20 74 65 72 6d 73 20 | 61 72 65 20 74 72 65 61 |l terms |are trea|
|00003750| 74 65 64 20 74 68 65 20 | 73 61 6d 65 20 77 61 79 |ted the |same way|
|00003760| 2e 0a 25 0a 25 20 54 68 | 65 20 63 6f 64 65 20 73 |..%.% Th|e code s|
|00003770| 65 71 75 65 6e 63 65 20 | 60 60 24 5c 7b 5c 2c 5c |equence |``$\{\,\|
|00003780| 73 7b 54 5f 32 7d 5c 2c | 5c 7d 5c 3b 42 5c 6c 61 |s{T_2}\,|\}\;B\la|
|00003790| 73 73 69 67 6e 20 42 2b | 41 24 27 27 20 63 61 6e |ssign B+|A$'' can|
|000037a0| 20 62 65 20 74 72 61 6e | 73 6c 61 74 65 64 0a 25 | be tran|slated.%|
|000037b0| 20 69 6e 74 6f 20 74 68 | 65 20 66 6f 6c 6c 6f 77 | into th|e follow|
|000037c0| 69 6e 67 20 65 71 75 69 | 76 61 6c 65 6e 74 20 63 |ing equi|valent c|
|000037d0| 6f 64 65 20 73 65 71 75 | 65 6e 63 65 3a 0a 25 20 |ode sequ|ence:.% |
|000037e0| 60 60 24 5c 7b 5c 73 61 | 76 65 63 6f 64 65 7b 42 |``$\{\sa|vecode{B|
|000037f0| 5c 6c 61 73 73 69 67 6e | 20 42 2b 41 7d 5c 2c 5c |\lassign| B+A}\,\|
|00003800| 73 7b 54 5f 32 7d 5c 2c | 5c 7d 24 27 27 2e 20 20 |s{T_2}\,|\}$''. |
|00003810| 54 68 69 73 20 6f 62 73 | 65 72 76 61 74 69 6f 6e |This obs|ervation|
|00003820| 20 74 75 72 6e 73 0a 25 | 20 6f 75 74 20 74 6f 20 | turns.%| out to |
|00003830| 62 65 20 74 68 65 20 6b | 65 79 20 74 6f 20 74 68 |be the k|ey to th|
|00003840| 65 20 69 6d 70 6c 65 6d | 65 6e 74 61 74 69 6f 6e |e implem|entation|
|00003850| 3a 20 54 68 65 20 60 60 | 24 5c 73 61 76 65 63 6f |: The ``|$\saveco|
|00003860| 64 65 7b 42 5c 6c 61 73 | 73 69 67 6e 0a 25 20 42 |de{B\las|sign.% B|
|00003870| 2b 41 7d 24 27 27 20 69 | 73 20 67 65 6e 65 72 61 |+A}$'' i|s genera|
|00003880| 74 65 64 20 5c 65 6d 70 | 68 7b 62 65 66 6f 72 65 |ted \emp|h{before|
|00003890| 7d 20 24 54 5f 32 24 20 | 69 73 20 74 72 61 6e 73 |} $T_2$ |is trans|
|000038a0| 6c 61 74 65 64 2c 20 61 | 74 20 74 68 65 20 73 61 |lated, a|t the sa|
|000038b0| 6d 65 0a 25 20 74 69 6d | 65 20 61 73 20 74 68 65 |me.% tim|e as the|
|000038c0| 20 60 24 2b 24 27 20 6f | 70 65 72 61 74 6f 72 20 | `$+$' o|perator |
|000038d0| 62 65 74 77 65 65 6e 20 | 24 54 5f 31 24 20 61 6e |between |$T_1$ an|
|000038e0| 64 7e 24 54 5f 32 24 20 | 69 73 20 73 65 65 6e 2e |d~$T_2$ |is seen.|
|000038f0| 0a 25 0a 25 20 4e 6f 77 | 2c 20 74 68 65 20 73 70 |.%.% Now|, the sp|
|00003900| 65 63 69 66 69 63 61 74 | 69 6f 6e 20 6f 66 20 74 |ecificat|ion of t|
|00003910| 68 65 20 74 72 61 6e 73 | 6c 61 74 69 6f 6e 20 73 |he trans|lation s|
|00003920| 63 68 65 6d 65 20 69 73 | 20 73 74 72 61 69 67 68 |cheme is| straigh|
|00003930| 74 66 6f 72 77 61 72 64 | 3a 0a 25 20 5c 62 65 67 |tforward|:.% \beg|
|00003940| 69 6e 7b 65 71 6e 61 72 | 72 61 79 2a 7d 0a 25 20 |in{eqnar|ray*}.% |
|00003950| 20 20 20 5c 73 7b 66 7d | 26 5c 4c 6f 6e 67 72 69 | \s{f}|&\Longri|
|00003960| 67 68 74 61 72 72 6f 77 | 26 41 5c 67 61 73 73 69 |ghtarrow|&A\gassi|
|00003970| 67 6e 20 66 5c 5c 5b 5c | 73 6d 61 6c 6c 73 6b 69 |gn f\\[\|smallski|
|00003980| 70 61 6d 6f 75 6e 74 5d | 0a 25 20 20 20 20 5c 73 |pamount]|.% \s|
|00003990| 7b 28 45 27 29 7d 26 5c | 4c 6f 6e 67 72 69 67 68 |{(E')}&\|Longrigh|
|000039a0| 74 61 72 72 6f 77 26 5c | 73 7b 45 27 7d 5c 5c 5b |tarrow&\|s{E'}\\[|
|000039b0| 5c 73 6d 61 6c 6c 73 6b | 69 70 61 6d 6f 75 6e 74 |\smallsk|ipamount|
|000039c0| 5d 0a 25 20 20 20 20 5c | 73 7b 46 5f 31 2a 46 5f |].% \|s{F_1*F_|
|000039d0| 32 2a 5c 63 64 6f 74 73 | 2a 46 5f 6d 7d 26 5c 4c |2*\cdots|*F_m}&\L|
|000039e0| 6f 6e 67 72 69 67 68 74 | 61 72 72 6f 77 26 0a 25 |ongright|arrow&.%|
|000039f0| 20 20 20 20 20 20 20 5c | 7b 5c 73 61 76 65 63 6f | \|{\saveco|
|00003a00| 64 65 7b 42 5c 6c 61 73 | 73 69 67 6e 20 41 7d 5c |de{B\las|sign A}\|
|00003a10| 2c 5c 73 7b 46 5f 31 7d | 5c 2c 5c 7d 20 5c 71 75 |,\s{F_1}|\,\} \qu|
|00003a20| 61 64 0a 25 20 20 20 20 | 20 20 20 5c 7b 5c 73 61 |ad.% | \{\sa|
|00003a30| 76 65 63 6f 64 65 7b 42 | 5c 6c 61 73 73 69 67 6e |vecode{B|\lassign|
|00003a40| 20 42 2a 41 7d 5c 2c 5c | 73 7b 46 5f 32 7d 5c 2c | B*A}\,\|s{F_2}\,|
|00003a50| 5c 7d 5c 5c 0a 25 20 20 | 20 20 20 20 20 26 26 5c |\}\\.% | &&\|
|00003a60| 71 71 75 61 64 20 5c 6c | 64 6f 74 73 20 5c 71 75 |qquad \l|dots \qu|
|00003a70| 61 64 20 5c 7b 5c 73 61 | 76 65 63 6f 64 65 7b 42 |ad \{\sa|vecode{B|
|00003a80| 5c 6c 61 73 73 69 67 6e | 20 42 2a 41 7d 5c 2c 5c |\lassign| B*A}\,\|
|00003a90| 73 7b 46 5f 6d 7d 5c 2c | 5c 7d 20 5c 71 75 61 64 |s{F_m}\,|\} \quad|
|00003aa0| 0a 25 20 20 20 20 20 20 | 20 41 5c 67 61 73 73 69 |.% | A\gassi|
|00003ab0| 67 6e 20 42 20 5c 5c 5b | 5c 73 6d 61 6c 6c 73 6b |gn B \\[|\smallsk|
|00003ac0| 69 70 61 6d 6f 75 6e 74 | 5d 0a 25 20 20 20 20 5c |ipamount|].% \|
|00003ad0| 73 7b 54 5f 31 2b 54 5f | 32 2b 5c 63 64 6f 74 73 |s{T_1+T_|2+\cdots|
|00003ae0| 2b 54 5f 6e 7d 26 5c 4c | 6f 6e 67 72 69 67 68 74 |+T_n}&\L|ongright|
|00003af0| 61 72 72 6f 77 26 0a 25 | 20 20 20 20 20 20 20 5c |arrow&.%| \|
|00003b00| 7b 5c 73 61 76 65 63 6f | 64 65 7b 42 5c 6c 61 73 |{\saveco|de{B\las|
|00003b10| 73 69 67 6e 20 41 7d 5c | 2c 5c 73 7b 54 5f 31 7d |sign A}\|,\s{T_1}|
|00003b20| 5c 2c 5c 7d 20 5c 71 75 | 61 64 0a 25 20 20 20 20 |\,\} \qu|ad.% |
|00003b30| 20 20 20 5c 7b 5c 73 61 | 76 65 63 6f 64 65 7b 42 | \{\sa|vecode{B|
|00003b40| 5c 6c 61 73 73 69 67 6e | 20 42 2b 41 7d 5c 2c 5c |\lassign| B+A}\,\|
|00003b50| 73 7b 54 5f 32 7d 5c 2c | 5c 7d 20 5c 5c 0a 25 20 |s{T_2}\,|\} \\.% |
|00003b60| 20 20 20 20 20 20 26 26 | 5c 71 71 75 61 64 20 5c | &&|\qquad \|
|00003b70| 6c 64 6f 74 73 20 5c 71 | 75 61 64 20 5c 7b 5c 73 |ldots \q|uad \{\s|
|00003b80| 61 76 65 63 6f 64 65 7b | 42 5c 6c 61 73 73 69 67 |avecode{|B\lassig|
|00003b90| 6e 20 42 2b 41 7d 5c 2c | 5c 73 7b 54 5f 6e 7d 5c |n B+A}\,|\s{T_n}\|
|00003ba0| 2c 5c 7d 0a 25 20 20 20 | 20 20 20 20 20 20 20 20 |,\}.% | |
|00003bb0| 20 20 20 20 20 20 20 20 | 20 20 20 20 5c 71 75 61 | | \qua|
|00003bc0| 64 20 41 5c 67 61 73 73 | 69 67 6e 20 42 0a 25 20 |d A\gass|ign B.% |
|00003bd0| 5c 65 6e 64 7b 65 71 6e | 61 72 72 61 79 2a 7d 0a |\end{eqn|array*}.|
|00003be0| 25 20 42 79 20 73 74 72 | 75 63 74 75 72 61 6c 20 |% By str|uctural |
|00003bf0| 69 6e 64 75 63 74 69 6f | 6e 2c 20 69 74 20 69 73 |inductio|n, it is|
|00003c00| 20 65 61 73 69 6c 79 20 | 73 65 65 6e 20 74 68 61 | easily |seen tha|
|00003c10| 74 20 74 68 65 20 73 74 | 61 74 65 64 20 70 72 6f |t the st|ated pro|
|00003c20| 70 65 72 74 79 0a 25 20 | 69 73 20 61 74 74 61 69 |perty.% |is attai|
|00003c30| 6e 65 64 2e 0a 25 0a 25 | 20 42 79 20 69 6e 73 70 |ned..%.%| By insp|
|00003c40| 65 63 74 69 6f 6e 20 6f | 66 20 74 68 69 73 20 74 |ection o|f this t|
|00003c50| 72 61 6e 73 6c 61 74 69 | 6f 6e 20 73 63 68 65 6d |ranslati|on schem|
|00003c60| 65 2c 20 77 65 20 73 65 | 65 20 74 68 61 74 20 77 |e, we se|e that w|
|00003c70| 65 20 68 61 76 65 20 74 | 6f 0a 25 20 67 65 6e 65 |e have t|o.% gene|
|00003c80| 72 61 74 65 20 74 68 65 | 20 66 6f 6c 6c 6f 77 69 |rate the| followi|
|00003c90| 6e 67 20 63 6f 64 65 3a | 0a 25 20 5c 62 65 67 69 |ng code:|.% \begi|
|00003ca0| 6e 7b 69 74 65 6d 69 7a | 65 7d 0a 25 20 20 20 20 |n{itemiz|e}.% |
|00003cb0| 5c 69 74 65 6d 20 77 65 | 20 6d 75 73 74 20 67 65 |\item we| must ge|
|00003cc0| 6e 65 72 61 74 65 20 60 | 60 24 5c 7b 5c 73 61 76 |nerate `|`$\{\sav|
|00003cd0| 65 63 6f 64 65 7b 42 5c | 6c 61 73 73 69 67 6e 0a |ecode{B\|lassign.|
|00003ce0| 25 20 20 20 20 20 20 20 | 41 7d 5c 7b 5c 73 61 76 |% |A}\{\sav|
|00003cf0| 65 63 6f 64 65 7b 42 5c | 6c 61 73 73 69 67 6e 20 |ecode{B\|lassign |
|00003d00| 41 7d 24 27 27 20 61 74 | 20 74 68 65 20 6c 65 66 |A}$'' at| the lef|
|00003d10| 74 20 62 6f 72 64 65 72 | 20 6f 66 20 61 6e 0a 25 |t border| of an.%|
|00003d20| 20 20 20 20 20 20 20 65 | 78 70 72 65 73 73 69 6f | e|xpressio|
|00003d30| 6e 20 28 69 2e 65 2e 2c | 20 66 6f 72 20 65 61 63 |n (i.e.,| for eac|
|00003d40| 68 20 6c 65 66 74 20 70 | 61 72 65 6e 74 68 65 73 |h left p|arenthes|
|00003d50| 69 73 20 61 6e 64 20 74 | 68 65 20 69 6d 70 6c 69 |is and t|he impli|
|00003d60| 63 69 74 0a 25 20 20 20 | 20 20 20 20 6c 65 66 74 |cit.% | left|
|00003d70| 20 70 61 72 65 6e 74 68 | 65 73 69 73 20 61 74 20 | parenth|esis at |
|00003d80| 74 68 65 20 62 65 67 69 | 6e 6e 69 6e 67 20 6f 66 |the begi|nning of|
|00003d90| 20 74 68 65 20 77 68 6f | 6c 65 20 65 78 70 72 65 | the who|le expre|
|00003da0| 73 73 69 6f 6e 29 3b 0a | 25 20 20 20 20 5c 69 74 |ssion);.|% \it|
|00003db0| 65 6d 20 77 65 20 6d 75 | 73 74 20 67 65 6e 65 72 |em we mu|st gener|
|00003dc0| 61 74 65 20 60 60 24 5c | 7d 41 5c 67 61 73 73 69 |ate ``$\|}A\gassi|
|00003dd0| 67 6e 20 42 5c 7d 41 5c | 67 61 73 73 69 67 6e 20 |gn B\}A\|gassign |
|00003de0| 42 24 27 27 20 61 74 20 | 74 68 65 0a 25 20 20 20 |B$'' at |the.% |
|00003df0| 20 20 20 20 72 69 67 68 | 74 20 62 6f 72 64 65 72 | righ|t border|
|00003e00| 20 6f 66 20 61 6e 20 65 | 78 70 72 65 73 73 69 6f | of an e|xpressio|
|00003e10| 6e 20 28 69 2e 65 2e 2c | 20 65 61 63 68 20 72 69 |n (i.e.,| each ri|
|00003e20| 67 68 74 20 70 61 72 65 | 6e 74 68 65 73 69 73 0a |ght pare|nthesis.|
|00003e30| 25 20 20 20 20 20 20 20 | 61 6e 64 20 74 68 65 20 |% |and the |
|00003e40| 69 6d 70 6c 69 63 69 74 | 20 72 69 67 68 74 20 70 |implicit| right p|
|00003e50| 61 72 65 6e 74 68 65 73 | 69 73 20 61 74 20 74 68 |arenthes|is at th|
|00003e60| 65 20 65 6e 64 20 6f 66 | 20 74 68 65 20 66 75 6c |e end of| the ful|
|00003e70| 6c 0a 25 20 20 20 20 20 | 20 20 65 78 70 72 65 73 |l.% | expres|
|00003e80| 73 69 6f 6e 29 3b 0a 25 | 20 20 20 20 5c 69 74 65 |sion);.%| \ite|
|00003e90| 6d 20 60 5c 74 65 78 74 | 74 74 7b 2a 7d 27 20 69 |m `\text|tt{*}' i|
|00003ea0| 73 20 72 65 70 6c 61 63 | 65 64 20 62 79 20 60 60 |s replac|ed by ``|
|00003eb0| 24 5c 7d 5c 7b 5c 73 61 | 76 65 63 6f 64 65 7b 42 |$\}\{\sa|vecode{B|
|00003ec0| 5c 6c 61 73 73 69 67 6e | 0a 25 20 20 20 20 20 20 |\lassign|.% |
|00003ed0| 20 42 2a 41 7d 24 27 27 | 3b 0a 25 20 20 20 20 5c | B*A}$''|;.% \|
|00003ee0| 69 74 65 6d 20 60 5c 74 | 65 78 74 74 74 7b 2b 7d |item `\t|exttt{+}|
|00003ef0| 27 20 69 73 20 72 65 70 | 6c 61 63 65 64 20 62 79 |' is rep|laced by|
|00003f00| 0a 25 20 20 20 20 20 20 | 20 60 60 24 5c 7d 41 5c |.% | ``$\}A\|
|00003f10| 67 61 73 73 69 67 6e 20 | 42 5c 7d 5c 7b 5c 73 61 |gassign |B\}\{\sa|
|00003f20| 76 65 63 6f 64 65 7b 42 | 5c 6c 61 73 73 69 67 6e |vecode{B|\lassign|
|00003f30| 0a 25 20 20 20 20 20 20 | 20 42 2b 41 7d 5c 7b 5c |.% | B+A}\{\|
|00003f40| 73 61 76 65 63 6f 64 65 | 7b 42 5c 6c 61 73 73 69 |savecode|{B\lassi|
|00003f50| 67 6e 20 41 7d 24 27 27 | 3b 0a 25 20 20 20 20 5c |gn A}$''|;.% \|
|00003f60| 69 74 65 6d 20 77 68 65 | 6e 20 77 65 20 73 65 65 |item whe|n we see|
|00003f70| 20 28 65 78 70 65 63 74 | 29 20 61 20 6e 75 6d 65 | (expect|) a nume|
|00003f80| 72 69 63 20 71 75 61 6e | 74 69 74 79 2c 20 77 65 |ric quan|tity, we|
|00003f90| 20 69 6e 73 65 72 74 20 | 74 68 65 0a 25 20 20 20 | insert |the.% |
|00003fa0| 20 61 73 73 69 67 6e 6d | 65 6e 74 20 63 6f 64 65 | assignm|ent code|
|00003fb0| 20 60 60 24 41 5c 67 61 | 73 73 69 67 6e 24 27 27 | ``$A\ga|ssign$''|
|00003fc0| 20 69 6e 20 66 72 6f 6e | 74 20 6f 66 20 74 68 65 | in fron|t of the|
|00003fd0| 20 71 75 61 6e 74 69 74 | 79 20 61 6e 64 20 6c 65 | quantit|y and le|
|00003fe0| 74 0a 25 20 20 20 20 5c | 54 65 58 5c 20 70 61 72 |t.% \|TeX\ par|
|00003ff0| 73 65 20 69 74 2e 0a 25 | 20 5c 65 6e 64 7b 69 74 |se it..%| \end{it|
|00004000| 65 6d 69 7a 65 7d 0a 25 | 0a 25 20 5c 73 65 63 74 |emize}.%|.% \sect|
|00004010| 69 6f 6e 7b 49 6d 70 6c | 65 6d 65 6e 74 61 74 69 |ion{Impl|ementati|
|00004020| 6f 6e 7d 0a 25 0a 25 20 | 46 6f 72 20 62 72 65 76 |on}.%.% |For brev|
|00004030| 69 74 79 20 64 65 66 69 | 6e 65 0a 25 20 5c 62 65 |ity defi|ne.% \be|
|00004040| 67 69 6e 7b 63 61 6c 63 | 2d 73 79 6e 74 61 78 7d |gin{calc|-syntax}|
|00004050| 0a 25 20 20 20 20 5c 3c | 6e 75 6d 65 72 69 63 3e |.% \<|numeric>|
|00004060| 20 5c 69 73 20 5c 3c 6e | 75 6d 62 65 72 3e 20 5c | \is \<n|umber> \|
|00004070| 61 6c 74 20 5c 3c 64 69 | 6d 65 6e 3e 20 5c 61 6c |alt \<di|men> \al|
|00004080| 74 20 5c 3c 67 6c 75 65 | 3e 20 5c 61 6c 74 20 5c |t \<glue|> \alt \|
|00004090| 3c 6d 75 67 6c 75 65 3e | 0a 25 20 5c 65 6e 64 7b |<muglue>|.% \end{|
|000040a0| 63 61 6c 63 2d 73 79 6e | 74 61 78 7d 0a 25 20 53 |calc-syn|tax}.% S|
|000040b0| 6f 20 66 61 72 20 77 65 | 20 68 61 76 65 20 69 67 |o far we| have ig|
|000040c0| 6e 6f 72 65 64 20 74 68 | 65 20 71 75 65 73 74 69 |nored th|e questi|
|000040d0| 6f 6e 20 6f 66 20 68 6f | 77 20 74 6f 20 64 65 74 |on of ho|w to det|
|000040e0| 65 72 6d 69 6e 65 20 74 | 68 65 20 74 79 70 65 20 |ermine t|he type |
|000040f0| 6f 66 0a 25 20 72 65 67 | 69 73 74 65 72 20 74 6f |of.% reg|ister to|
|00004100| 20 62 65 20 75 73 65 64 | 20 69 6e 20 74 68 65 20 | be used| in the |
|00004110| 63 6f 64 65 2e 20 20 48 | 6f 77 65 76 65 72 2c 20 |code. H|owever, |
|00004120| 69 74 20 69 73 20 65 61 | 73 79 20 74 6f 20 73 65 |it is ea|sy to se|
|00004130| 65 20 74 68 61 74 0a 25 | 20 28 31 29 7e 60 24 2a |e that.%| (1)~`$*|
|00004140| 24 27 20 61 6c 77 61 79 | 73 20 69 6e 69 74 69 61 |$' alway|s initia|
|00004150| 74 65 73 20 61 6e 20 5c | 3c 69 6e 74 65 67 65 72 |tes an \|<integer|
|00004160| 20 66 61 63 74 6f 72 3e | 2c 20 28 32 29 7e 61 6c | factor>|, (2)~al|
|00004170| 6c 0a 25 20 5c 3c 6e 75 | 6d 65 72 69 63 3e 73 20 |l.% \<nu|meric>s |
|00004180| 69 6e 20 61 6e 20 65 78 | 70 72 65 73 73 69 6f 6e |in an ex|pression|
|00004190| 2c 20 65 78 63 65 70 74 | 20 74 68 6f 73 65 20 77 |, except| those w|
|000041a0| 68 69 63 68 20 61 72 65 | 20 70 61 72 74 20 6f 66 |hich are| part of|
|000041b0| 20 61 6e 0a 25 20 5c 3c | 69 6e 74 65 67 65 72 20 | an.% \<|integer |
|000041c0| 66 61 63 74 6f 72 3e 2c | 20 61 72 65 20 6f 66 20 |factor>,| are of |
|000041d0| 74 68 65 20 73 61 6d 65 | 20 74 79 70 65 20 61 73 |the same| type as|
|000041e0| 20 74 68 65 20 77 68 6f | 6c 65 20 65 78 70 72 65 | the who|le expre|
|000041f0| 73 73 69 6f 6e 2c 20 61 | 6e 64 0a 25 20 61 6c 6c |ssion, a|nd.% all|
|00004200| 20 5c 3c 6e 75 6d 65 72 | 69 63 3e 73 20 69 6e 20 | \<numer|ic>s in |
|00004210| 61 6e 20 5c 3c 69 6e 74 | 65 67 65 72 20 66 61 63 |an \<int|eger fac|
|00004220| 74 6f 72 3e 20 61 72 65 | 20 5c 3c 6e 75 6d 62 65 |tor> are| \<numbe|
|00004230| 72 3e 73 2e 20 0a 25 0a | 25 20 57 65 20 68 61 76 |r>s. .%.|% We hav|
|00004240| 65 20 74 6f 20 65 6e 73 | 75 72 65 20 74 68 61 74 |e to ens|ure that|
|00004250| 20 24 41 24 20 61 6e 64 | 7e 24 42 24 20 61 6c 77 | $A$ and|~$B$ alw|
|00004260| 61 79 73 20 68 61 76 65 | 20 61 6e 20 61 70 70 72 |ays have| an appr|
|00004270| 6f 70 72 69 61 74 65 20 | 74 79 70 65 0a 25 20 66 |opriate |type.% f|
|00004280| 6f 72 20 74 68 65 20 5c | 3c 6e 75 6d 65 72 69 63 |or the \|<numeric|
|00004290| 3e 73 20 74 68 65 79 20 | 6d 61 6e 69 70 75 6c 61 |>s they |manipula|
|000042a0| 74 65 2e 20 20 57 65 20 | 63 61 6e 20 61 63 68 69 |te. We |can achi|
|000042b0| 65 76 65 20 74 68 69 73 | 20 62 79 20 68 61 76 69 |eve this| by havi|
|000042c0| 6e 67 0a 25 20 61 6e 20 | 69 6e 73 74 61 6e 63 65 |ng.% an |instance|
|000042d0| 20 6f 66 20 24 41 24 20 | 61 6e 64 7e 24 42 24 20 | of $A$ |and~$B$ |
|000042e0| 66 6f 72 20 65 61 63 68 | 20 74 79 70 65 2e 20 20 |for each| type. |
|000042f0| 49 6e 69 74 69 61 6c 6c | 79 2c 20 24 41 24 7e 61 |Initiall|y, $A$~a|
|00004300| 6e 64 7e 24 42 24 0a 25 | 20 72 65 66 65 72 20 74 |nd~$B$.%| refer t|
|00004310| 6f 20 72 65 67 69 73 74 | 65 72 73 20 6f 66 20 74 |o regist|ers of t|
|00004320| 68 65 20 70 72 6f 70 65 | 72 20 74 79 70 65 20 66 |he prope|r type f|
|00004330| 6f 72 20 74 68 65 20 77 | 68 6f 6c 65 20 65 78 70 |or the w|hole exp|
|00004340| 72 65 73 73 69 6f 6e 2e | 0a 25 20 57 68 65 6e 20 |ression.|.% When |
|00004350| 61 6e 20 5c 3c 69 6e 74 | 65 67 65 72 20 66 61 63 |an \<int|eger fac|
|00004360| 74 6f 72 3e 20 69 73 20 | 65 78 70 65 63 74 65 64 |tor> is |expected|
|00004370| 2c 20 77 65 20 6d 75 73 | 74 20 63 68 61 6e 67 65 |, we mus|t change|
|00004380| 20 24 41 24 20 61 6e 64 | 7e 24 42 24 20 74 6f 0a | $A$ and|~$B$ to.|
|00004390| 25 20 72 65 66 65 72 20 | 74 6f 20 69 6e 74 65 67 |% refer |to integ|
|000043a0| 65 72 20 74 79 70 65 20 | 72 65 67 69 73 74 65 72 |er type |register|
|000043b0| 73 2e 20 20 57 65 20 63 | 61 6e 20 61 63 63 6f 6d |s. We c|an accom|
|000043c0| 70 6c 69 73 68 20 74 68 | 69 73 20 62 79 0a 25 20 |plish th|is by.% |
|000043d0| 69 6e 63 6c 75 64 69 6e | 67 20 69 6e 73 74 72 75 |includin|g instru|
|000043e0| 63 74 69 6f 6e 73 20 74 | 6f 20 63 68 61 6e 67 65 |ctions t|o change|
|000043f0| 20 74 68 65 20 74 79 70 | 65 20 6f 66 20 24 41 24 | the typ|e of $A$|
|00004400| 20 61 6e 64 7e 24 42 24 | 20 74 6f 20 69 6e 74 65 | and~$B$| to inte|
|00004410| 67 65 72 0a 25 20 74 79 | 70 65 20 61 73 20 70 61 |ger.% ty|pe as pa|
|00004420| 72 74 20 6f 66 20 74 68 | 65 20 72 65 70 6c 61 63 |rt of th|e replac|
|00004430| 65 6d 65 6e 74 20 63 6f | 64 65 20 66 6f 72 7e 60 |ement co|de for~`|
|00004440| 24 2a 24 3b 20 69 66 20 | 77 65 20 61 70 70 65 6e |$*$; if |we appen|
|00004450| 64 20 73 75 63 68 0a 25 | 20 69 6e 73 74 72 75 63 |d such.%| instruc|
|00004460| 74 69 6f 6e 73 20 74 6f | 20 74 68 65 20 72 65 70 |tions to| the rep|
|00004470| 6c 61 63 65 6d 65 6e 74 | 20 63 6f 64 65 20 64 65 |lacement| code de|
|00004480| 73 63 72 69 62 65 64 20 | 61 62 6f 76 65 2c 20 77 |scribed |above, w|
|00004490| 65 20 61 6c 73 6f 20 65 | 6e 73 75 72 65 0a 25 20 |e also e|nsure.% |
|000044a0| 74 68 61 74 20 74 68 65 | 20 74 79 70 65 2d 63 68 |that the| type-ch|
|000044b0| 61 6e 67 65 20 69 73 20 | 6c 6f 63 61 6c 20 28 70 |ange is |local (p|
|000044c0| 72 6f 76 69 64 65 64 20 | 74 68 61 74 20 74 68 65 |rovided |that the|
|000044d0| 20 74 79 70 65 2d 63 68 | 61 6e 67 69 6e 67 0a 25 | type-ch|anging.%|
|000044e0| 20 69 6e 73 74 72 75 63 | 74 69 6f 6e 73 20 6f 6e | instruc|tions on|
|000044f0| 6c 79 20 68 61 76 65 20 | 6c 6f 63 61 6c 20 65 66 |ly have |local ef|
|00004500| 66 65 63 74 29 2e 20 20 | 48 6f 77 65 76 65 72 2c |fect). |However,|
|00004510| 20 6e 6f 74 65 20 74 68 | 61 74 20 74 68 65 0a 25 | note th|at the.%|
|00004520| 20 69 6e 73 74 61 6e 63 | 65 20 6f 66 7e 24 41 24 | instanc|e of~$A$|
|00004530| 20 72 65 66 65 72 72 65 | 64 20 74 6f 20 69 6e 20 | referre|d to in |
|00004540| 24 5c 73 61 76 65 63 6f | 64 65 7b 42 5c 6c 61 73 |$\saveco|de{B\las|
|00004550| 73 69 67 6e 20 42 2a 41 | 7d 24 20 69 73 20 74 68 |sign B*A|}$ is th|
|00004560| 65 0a 25 20 69 6e 74 65 | 67 65 72 20 69 6e 73 74 |e.% inte|ger inst|
|00004570| 61 6e 63 65 20 6f 66 7e | 24 41 24 2e 0a 25 0a 25 |ance of~|$A$..%.%|
|00004580| 20 57 65 20 73 68 61 6c | 6c 20 75 73 65 20 7c 5c | We shal|l use |\|
|00004590| 62 65 67 69 6e 67 72 6f | 75 70 7c 20 61 6e 64 20 |begingro|up| and |
|000045a0| 7c 5c 65 6e 64 67 72 6f | 75 70 7c 20 66 6f 72 20 ||\endgro|up| for |
|000045b0| 74 68 65 20 6f 70 65 6e | 2d 67 72 6f 75 70 20 61 |the open|-group a|
|000045c0| 6e 64 0a 25 20 63 6c 6f | 73 65 2d 67 72 6f 75 70 |nd.% clo|se-group|
|000045d0| 20 63 68 61 72 61 63 74 | 65 72 73 2e 20 20 54 68 | charact|ers. Th|
|000045e0| 69 73 20 61 76 6f 69 64 | 73 20 70 72 6f 62 6c 65 |is avoid|s proble|
|000045f0| 6d 73 20 77 69 74 68 20 | 73 70 61 63 69 6e 67 20 |ms with |spacing |
|00004600| 69 6e 20 6d 61 74 68 0a | 25 20 28 61 73 20 70 6f |in math.|% (as po|
|00004610| 69 6e 74 65 64 20 6f 75 | 74 20 74 6f 20 75 73 20 |inted ou|t to us |
|00004620| 62 79 20 46 72 61 6e 6b | 20 4d 69 74 74 65 6c 62 |by Frank| Mittelb|
|00004630| 61 63 68 29 2e 0a 25 0a | 25 20 5c 73 75 62 73 65 |ach)..%.|% \subse|
|00004640| 63 74 69 6f 6e 7b 47 65 | 74 74 69 6e 67 20 73 74 |ction{Ge|tting st|
|00004650| 61 72 74 65 64 7d 0a 25 | 0a 25 20 4e 6f 77 20 77 |arted}.%|.% Now w|
|00004660| 65 20 68 61 76 65 20 65 | 6e 6f 75 67 68 20 69 6e |e have e|nough in|
|00004670| 73 69 67 68 74 20 74 6f | 20 64 6f 20 74 68 65 20 |sight to| do the |
|00004680| 61 63 74 75 61 6c 20 69 | 6d 70 6c 65 6d 65 6e 74 |actual i|mplement|
|00004690| 61 74 69 6f 6e 20 69 6e | 20 5c 54 65 58 2e 0a 25 |ation in| \TeX..%|
|000046a0| 20 46 69 72 73 74 2c 20 | 77 65 20 61 6e 6e 6f 75 | First, |we annou|
|000046b0| 6e 63 65 20 74 68 65 20 | 6d 61 63 72 6f 20 70 61 |nce the |macro pa|
|000046c0| 63 6b 61 67 65 2e 0a 25 | 20 20 20 20 5c 62 65 67 |ckage..%| \beg|
|000046d0| 69 6e 7b 6d 61 63 72 6f | 63 6f 64 65 7d 20 0a 25 |in{macro|code} .%|
|000046e0| 3c 2a 70 61 63 6b 61 67 | 65 3e 0a 5c 4e 65 65 64 |<*packag|e>.\Need|
|000046f0| 73 54 65 58 46 6f 72 6d | 61 74 7b 4c 61 54 65 58 |sTeXForm|at{LaTeX|
|00004700| 32 65 7d 0a 5c 50 72 6f | 76 69 64 65 73 50 61 63 |2e}.\Pro|videsPac|
|00004710| 6b 61 67 65 7b 63 61 6c | 63 7d 5b 5c 66 69 6c 65 |kage{cal|c}[\file|
|00004720| 64 61 74 65 5c 73 70 61 | 63 65 5c 66 69 6c 65 76 |date\spa|ce\filev|
|00004730| 65 72 73 69 6f 6e 5d 0a | 5c 74 79 70 65 6f 75 74 |ersion].|\typeout|
|00004740| 7b 50 61 63 6b 61 67 65 | 3a 20 60 63 61 6c 63 27 |{Package|: `calc'|
|00004750| 20 5c 66 69 6c 65 76 65 | 72 73 69 6f 6e 5c 73 70 | \fileve|rsion\sp|
|00004760| 61 63 65 20 3c 5c 66 69 | 6c 65 64 61 74 65 3e 20 |ace <\fi|ledate> |
|00004770| 28 4b 4b 54 20 61 6e 64 | 20 46 4a 29 7d 0a 25 20 |(KKT and| FJ)}.% |
|00004780| 20 20 20 5c 65 6e 64 7b | 6d 61 63 72 6f 63 6f 64 | \end{|macrocod|
|00004790| 65 7d 0a 25 0a 25 20 5c | 73 75 62 73 65 63 74 69 |e}.%.% \|subsecti|
|000047a0| 6f 6e 7b 41 73 73 69 67 | 6e 6d 65 6e 74 20 6d 61 |on{Assig|nment ma|
|000047b0| 63 72 6f 73 7d 0a 25 0a | 25 20 5c 62 65 67 69 6e |cros}.%.|% \begin|
|000047c0| 7b 6d 61 63 72 6f 7d 7b | 5c 63 61 6c 63 40 61 73 |{macro}{|\calc@as|
|000047d0| 73 69 67 6e 40 67 65 6e | 65 72 69 63 7d 0a 25 20 |sign@gen|eric}.% |
|000047e0| 54 68 65 20 7c 5c 63 61 | 6c 63 40 61 73 73 69 67 |The |\ca|lc@assig|
|000047f0| 6e 40 67 65 6e 65 72 69 | 63 7c 20 6d 61 63 72 6f |n@generi|c| macro|
|00004800| 20 74 61 6b 65 73 20 66 | 6f 75 72 20 61 72 67 75 | takes f|our argu|
|00004810| 6d 65 6e 74 73 3a 20 28 | 31 7e 61 6e 64 7e 32 29 |ments: (|1~and~2)|
|00004820| 20 74 68 65 0a 25 20 72 | 65 67 69 73 74 65 72 73 | the.% r|egisters|
|00004830| 20 74 6f 20 62 65 20 75 | 73 65 64 20 0a 25 20 66 | to be u|sed .% f|
|00004840| 6f 72 20 67 6c 6f 62 61 | 6c 20 61 6e 64 20 6c 6f |or globa|l and lo|
|00004850| 63 61 6c 20 6d 61 6e 69 | 70 75 6c 61 74 69 6f 6e |cal mani|pulation|
|00004860| 73 2c 20 72 65 73 70 65 | 63 74 69 76 65 6c 79 3b |s, respe|ctively;|
|00004870| 20 28 33 29 7e 74 68 65 | 20 6c 76 61 6c 75 65 0a | (3)~the| lvalue.|
|00004880| 25 20 70 61 72 74 3b 20 | 28 34 29 7e 74 68 65 20 |% part; |(4)~the |
|00004890| 65 78 70 72 65 73 73 69 | 6f 6e 20 74 6f 20 62 65 |expressi|on to be|
|000048a0| 20 65 76 61 6c 75 61 74 | 65 64 2e 0a 25 0a 25 20 | evaluat|ed..%.% |
|000048b0| 54 68 65 20 74 68 69 72 | 64 20 61 72 67 75 6d 65 |The thir|d argume|
|000048c0| 6e 74 20 28 74 68 65 20 | 6c 76 61 6c 75 65 29 20 |nt (the |lvalue) |
|000048d0| 77 69 6c 6c 20 62 65 20 | 75 73 65 64 20 61 73 20 |will be |used as |
|000048e0| 61 20 70 72 65 66 69 78 | 20 74 6f 20 61 0a 25 20 |a prefix| to a.% |
|000048f0| 72 65 67 69 73 74 65 72 | 20 74 68 61 74 20 63 6f |register| that co|
|00004900| 6e 74 61 69 6e 73 20 74 | 68 65 20 76 61 6c 75 65 |ntains t|he value|
|00004910| 20 6f 66 20 74 68 65 20 | 73 70 65 63 69 66 69 65 | of the |specifie|
|00004920| 64 20 65 78 70 72 65 73 | 73 69 6f 6e 20 28 74 68 |d expres|sion (th|
|00004930| 65 0a 25 20 66 6f 75 72 | 74 68 20 61 72 67 75 6d |e.% four|th argum|
|00004940| 65 6e 74 29 2e 0a 25 0a | 25 20 49 6e 20 67 65 6e |ent)..%.|% In gen|
|00004950| 65 72 61 6c 2c 20 61 6e | 20 6c 76 61 6c 75 65 20 |eral, an| lvalue |
|00004960| 69 73 20 61 6e 79 74 68 | 69 6e 67 20 74 68 61 74 |is anyth|ing that|
|00004970| 20 6d 61 79 20 62 65 20 | 66 6f 6c 6c 6f 77 65 64 | may be |followed|
|00004980| 20 62 79 20 61 20 76 61 | 72 69 61 62 6c 65 0a 25 | by a va|riable.%|
|00004990| 20 6f 66 20 74 68 65 20 | 61 70 70 72 6f 70 72 69 | of the |appropri|
|000049a0| 61 74 65 20 74 79 70 65 | 2e 20 20 41 73 20 61 6e |ate type|. As an|
|000049b0| 20 65 78 61 6d 70 6c 65 | 2c 20 7c 5c 6c 69 6e 65 | example|, |\line|
|000049c0| 70 65 6e 61 6c 74 79 7c | 20 61 6e 64 0a 25 20 7c |penalty|| and.% ||
|000049d0| 5c 67 6c 6f 62 61 6c 5c | 61 64 76 61 6e 63 65 5c |\global\|advance\|
|000049e0| 6c 69 6e 65 70 65 6e 61 | 6c 74 79 7c 20 6d 61 79 |linepena|lty| may|
|000049f0| 20 62 6f 74 68 20 62 65 | 20 66 6f 6c 6c 6f 77 65 | both be| followe|
|00004a00| 64 20 62 79 20 61 6e 20 | 5c 3c 69 6e 74 65 67 65 |d by an |\<intege|
|00004a10| 72 0a 25 20 76 61 72 69 | 61 62 6c 65 3e 2e 0a 25 |r.% vari|able>..%|
|00004a20| 0a 25 20 54 68 65 20 6d | 61 63 72 6f 73 20 64 65 |.% The m|acros de|
|00004a30| 73 63 72 69 62 65 64 20 | 62 65 6c 6f 77 20 72 65 |scribed |below re|
|00004a40| 66 65 72 20 74 6f 20 74 | 68 65 20 72 65 67 69 73 |fer to t|he regis|
|00004a50| 74 65 72 73 20 62 79 20 | 74 68 65 20 6e 61 6d 65 |ters by |the name|
|00004a60| 73 0a 25 20 7c 5c 63 61 | 6c 63 40 41 7c 20 61 6e |s.% |\ca|lc@A| an|
|00004a70| 64 20 7c 5c 63 61 6c 63 | 40 42 7c 3b 20 74 68 69 |d |\calc|@B|; thi|
|00004a80| 73 20 69 73 20 61 63 63 | 6f 6d 70 6c 69 73 68 65 |s is acc|omplishe|
|00004a90| 64 20 62 79 0a 25 20 7c | 5c 6c 65 74 7c 2d 61 73 |d by.% ||\let|-as|
|00004aa0| 73 69 67 6e 6d 65 6e 74 | 73 2e 0a 25 0a 25 20 41 |signment|s..%.% A|
|00004ab0| 73 20 64 69 73 63 6f 76 | 65 72 65 64 20 69 6e 20 |s discov|ered in |
|00004ac0| 53 65 63 74 69 6f 6e 7e | 5c 72 65 66 7b 65 76 61 |Section~|\ref{eva|
|00004ad0| 6c 75 61 74 69 6f 6e 3a | 73 63 68 65 6d 65 7d 2c |luation:|scheme},|
|00004ae0| 20 77 65 20 68 61 76 65 | 20 74 6f 0a 25 20 67 65 | we have| to.% ge|
|00004af0| 6e 65 72 61 74 65 20 63 | 6f 64 65 20 61 73 20 0a |nerate c|ode as .|
|00004b00| 25 20 69 66 20 74 68 65 | 20 65 78 70 72 65 73 73 |% if the| express|
|00004b10| 69 6f 6e 20 69 73 20 70 | 61 72 65 6e 74 68 65 73 |ion is p|arenthes|
|00004b20| 69 7a 65 64 2e 20 20 41 | 73 20 64 65 73 63 72 69 |ized. A|s descri|
|00004b30| 62 65 64 20 62 65 6c 6f | 77 2c 0a 25 20 7c 5c 63 |bed belo|w,.% |\c|
|00004b40| 61 6c 63 40 6f 70 65 6e | 7c 20 69 73 20 74 68 65 |alc@open|| is the|
|00004b50| 20 6d 61 63 72 6f 20 74 | 68 61 74 20 72 65 70 6c | macro t|hat repl|
|00004b60| 61 63 65 73 20 61 20 6c | 65 66 74 20 70 61 72 65 |aces a l|eft pare|
|00004b70| 6e 74 68 65 73 65 69 73 | 20 62 79 20 69 74 73 0a |ntheseis| by its.|
|00004b80| 25 20 63 6f 72 72 65 73 | 70 6f 6e 64 69 6e 67 20 |% corres|ponding |
|00004b90| 5c 54 65 58 5c 20 63 6f | 64 65 20 73 65 71 75 65 |\TeX\ co|de seque|
|00004ba0| 6e 63 65 2e 20 20 57 68 | 65 6e 20 74 68 65 20 73 |nce. Wh|en the s|
|00004bb0| 63 61 6e 6e 69 6e 67 20 | 70 72 6f 63 65 73 73 20 |canning |process |
|00004bc0| 73 65 65 73 0a 25 20 74 | 68 65 20 65 78 63 6c 61 |sees.% t|he excla|
|00004bd0| 6d 61 74 69 6f 6e 20 70 | 6f 69 6e 74 2c 20 69 74 |mation p|oint, it|
|00004be0| 20 67 65 6e 65 72 61 74 | 65 73 20 61 6e 20 7c 5c | generat|es an |\|
|00004bf0| 65 6e 64 67 72 6f 75 70 | 7c 20 61 6e 64 20 73 74 |endgroup|| and st|
|00004c00| 6f 70 73 2e 20 20 41 73 | 20 77 65 0a 25 20 72 65 |ops. As| we.% re|
|00004c10| 63 61 6c 6c 20 66 72 6f | 6d 20 53 65 63 74 69 6f |call fro|m Sectio|
|00004c20| 6e 7e 5c 72 65 66 7b 65 | 76 61 6c 75 61 74 69 6f |n~\ref{e|valuatio|
|00004c30| 6e 3a 73 63 68 65 6d 65 | 7d 2c 20 74 68 65 20 63 |n:scheme|}, the c|
|00004c40| 6f 72 72 65 63 74 20 65 | 78 70 61 6e 73 69 6f 6e |orrect e|xpansion|
|00004c50| 0a 25 20 6f 66 20 61 20 | 72 69 67 68 74 20 0a 25 |.% of a |right .%|
|00004c60| 20 70 61 72 65 6e 74 68 | 65 73 69 73 20 69 73 20 | parenth|esis is |
|00004c70| 60 60 24 5c 7d 41 5c 67 | 61 73 73 69 67 6e 20 42 |``$\}A\g|assign B|
|00004c80| 5c 7d 41 5c 67 61 73 73 | 69 67 6e 20 42 24 27 27 |\}A\gass|ign B$''|
|00004c90| 2e 20 20 54 68 65 20 72 | 65 6d 61 69 6e 69 6e 67 |. The r|emaining|
|00004ca0| 0a 25 20 74 6f 6b 65 6e | 73 20 6f 66 20 74 68 69 |.% token|s of thi|
|00004cb0| 73 20 65 78 70 61 6e 73 | 69 6f 6e 20 61 72 65 20 |s expans|ion are |
|00004cc0| 69 6e 73 65 72 74 65 64 | 20 65 78 70 6c 69 63 69 |inserted| explici|
|00004cd0| 74 6c 79 2c 20 65 78 63 | 65 70 74 20 74 68 61 74 |tly, exc|ept that|
|00004ce0| 20 74 68 65 0a 25 20 6c | 61 73 74 20 61 73 73 69 | the.% l|ast assi|
|00004cf0| 67 6e 6d 65 6e 74 20 68 | 61 73 20 62 65 65 6e 20 |gnment h|as been |
|00004d00| 72 65 70 6c 61 63 65 64 | 20 62 79 20 74 68 65 20 |replaced| by the |
|00004d10| 6c 76 61 6c 75 65 20 70 | 61 72 74 20 28 69 2e 65 |lvalue p|art (i.e|
|00004d20| 2e 2c 0a 25 20 61 72 67 | 75 6d 65 6e 74 7e 7c 23 |.,.% arg|ument~|#|
|00004d30| 33 7c 20 6f 66 20 7c 5c | 63 61 6c 63 40 61 73 73 |3| of |\|calc@ass|
|00004d40| 69 67 6e 40 67 65 6e 65 | 72 69 63 7c 29 20 66 6f |ign@gene|ric|) fo|
|00004d50| 6c 6c 6f 77 65 64 20 62 | 79 20 7c 5c 63 61 6c 63 |llowed b|y |\calc|
|00004d60| 40 42 7c 2e 0a 25 20 5c | 65 6e 64 7b 6d 61 63 72 |@B|..% \|end{macr|
|00004d70| 6f 7d 0a 25 20 20 20 20 | 5c 62 65 67 69 6e 7b 6d |o}.% |\begin{m|
|00004d80| 61 63 72 6f 63 6f 64 65 | 7d 0a 5c 64 65 66 5c 63 |acrocode|}.\def\c|
|00004d90| 61 6c 63 40 61 73 73 69 | 67 6e 40 67 65 6e 65 72 |alc@assi|gn@gener|
|00004da0| 69 63 23 31 23 32 23 33 | 23 34 7b 5c 6c 65 74 5c |ic#1#2#3|#4{\let\|
|00004db0| 63 61 6c 63 40 41 23 31 | 5c 6c 65 74 5c 63 61 6c |calc@A#1|\let\cal|
|00004dc0| 63 40 42 23 32 25 0a 20 | 20 20 20 5c 63 61 6c 63 |c@B#2%. | \calc|
|00004dd0| 40 6f 70 65 6e 28 23 34 | 21 5c 67 6c 6f 62 61 6c |@open(#4|!\global|
|00004de0| 5c 63 61 6c 63 40 41 5c | 63 61 6c 63 40 42 5c 65 |\calc@A\|calc@B\e|
|00004df0| 6e 64 67 72 6f 75 70 23 | 33 5c 63 61 6c 63 40 42 |ndgroup#|3\calc@B|
|00004e00| 7d 0a 25 20 20 20 20 5c | 65 6e 64 7b 6d 61 63 72 |}.% \|end{macr|
|00004e10| 6f 63 6f 64 65 7d 0a 25 | 0a 25 20 5c 62 65 67 69 |ocode}.%|.% \begi|
|00004e20| 6e 7b 6d 61 63 72 6f 7d | 7b 5c 63 61 6c 63 40 61 |n{macro}|{\calc@a|
|00004e30| 73 73 69 67 6e 40 63 6f | 75 6e 74 7d 0a 25 20 5c |ssign@co|unt}.% \|
|00004e40| 62 65 67 69 6e 7b 6d 61 | 63 72 6f 7d 7b 5c 63 61 |begin{ma|cro}{\ca|
|00004e50| 6c 63 40 61 73 73 69 67 | 6e 40 64 69 6d 65 6e 7d |lc@assig|n@dimen}|
|00004e60| 0a 25 20 5c 62 65 67 69 | 6e 7b 6d 61 63 72 6f 7d |.% \begi|n{macro}|
|00004e70| 7b 5c 63 61 6c 63 40 61 | 73 73 69 67 6e 40 73 6b |{\calc@a|ssign@sk|
|00004e80| 69 70 7d 0a 25 20 57 65 | 20 6e 65 65 64 20 74 68 |ip}.% We| need th|
|00004e90| 72 65 65 20 69 6e 73 74 | 61 6e 63 65 73 20 6f 66 |ree inst|ances of|
|00004ea0| 20 74 68 65 20 7c 5c 63 | 61 6c 63 40 61 73 73 69 | the |\c|alc@assi|
|00004eb0| 67 6e 40 67 65 6e 65 72 | 69 63 7c 20 6d 61 63 72 |gn@gener|ic| macr|
|00004ec0| 6f 2c 0a 25 20 63 6f 72 | 72 65 73 70 6f 6e 64 69 |o,.% cor|respondi|
|00004ed0| 6e 67 20 74 6f 20 74 68 | 65 20 74 79 70 65 73 20 |ng to th|e types |
|00004ee0| 5c 3c 69 6e 74 65 67 65 | 72 3e 2c 20 5c 3c 64 69 |\<intege|r>, \<di|
|00004ef0| 6d 65 6e 3e 2c 20 61 6e | 64 20 5c 3c 67 6c 75 65 |men>, an|d \<glue|
|00004f00| 3e 2e 0a 25 20 20 20 20 | 5c 62 65 67 69 6e 7b 6d |>..% |\begin{m|
|00004f10| 61 63 72 6f 63 6f 64 65 | 7d 0a 5c 64 65 66 5c 63 |acrocode|}.\def\c|
|00004f20| 61 6c 63 40 61 73 73 69 | 67 6e 40 63 6f 75 6e 74 |alc@assi|gn@count|
|00004f30| 7b 5c 63 61 6c 63 40 61 | 73 73 69 67 6e 40 67 65 |{\calc@a|ssign@ge|
|00004f40| 6e 65 72 69 63 5c 63 61 | 6c 63 40 41 63 6f 75 6e |neric\ca|lc@Acoun|
|00004f50| 74 5c 63 61 6c 63 40 42 | 63 6f 75 6e 74 7d 0a 5c |t\calc@B|count}.\|
|00004f60| 64 65 66 5c 63 61 6c 63 | 40 61 73 73 69 67 6e 40 |def\calc|@assign@|
|00004f70| 64 69 6d 65 6e 7b 5c 63 | 61 6c 63 40 61 73 73 69 |dimen{\c|alc@assi|
|00004f80| 67 6e 40 67 65 6e 65 72 | 69 63 5c 63 61 6c 63 40 |gn@gener|ic\calc@|
|00004f90| 41 64 69 6d 65 6e 5c 63 | 61 6c 63 40 42 64 69 6d |Adimen\c|alc@Bdim|
|00004fa0| 65 6e 7d 0a 5c 64 65 66 | 5c 63 61 6c 63 40 61 73 |en}.\def|\calc@as|
|00004fb0| 73 69 67 6e 40 73 6b 69 | 70 7b 5c 63 61 6c 63 40 |sign@ski|p{\calc@|
|00004fc0| 61 73 73 69 67 6e 40 67 | 65 6e 65 72 69 63 5c 63 |assign@g|eneric\c|
|00004fd0| 61 6c 63 40 41 73 6b 69 | 70 5c 63 61 6c 63 40 42 |alc@Aski|p\calc@B|
|00004fe0| 73 6b 69 70 7d 0a 25 20 | 20 20 20 5c 65 6e 64 7b |skip}.% | \end{|
|00004ff0| 6d 61 63 72 6f 63 6f 64 | 65 7d 0a 25 20 5c 65 6e |macrocod|e}.% \en|
|00005000| 64 7b 6d 61 63 72 6f 7d | 5c 65 6e 64 7b 6d 61 63 |d{macro}|\end{mac|
|00005010| 72 6f 7d 5c 65 6e 64 7b | 6d 61 63 72 6f 7d 0a 25 |ro}\end{|macro}.%|
|00005020| 20 54 68 65 73 65 20 6d | 61 63 72 6f 73 20 65 61 | These m|acros ea|
|00005030| 63 68 20 72 65 66 65 72 | 20 74 6f 20 74 77 6f 20 |ch refer| to two |
|00005040| 72 65 67 69 73 74 65 72 | 73 2c 20 6f 6e 65 0a 25 |register|s, one.%|
|00005050| 20 74 6f 20 62 65 20 75 | 73 65 64 20 67 6c 6f 62 | to be u|sed glob|
|00005060| 61 6c 6c 79 20 61 6e 64 | 20 6f 6e 65 20 74 6f 20 |ally and| one to |
|00005070| 62 65 20 75 73 65 64 20 | 6c 6f 63 61 6c 6c 79 2e |be used |locally.|
|00005080| 0a 25 20 57 65 20 6d 75 | 73 74 20 61 6c 6c 6f 63 |.% We mu|st alloc|
|00005090| 61 74 65 20 74 68 65 73 | 65 20 72 65 67 69 73 74 |ate thes|e regist|
|000050a0| 65 72 73 2e 0a 25 20 20 | 20 20 5c 62 65 67 69 6e |ers..% | \begin|
|000050b0| 7b 6d 61 63 72 6f 63 6f | 64 65 7d 0a 5c 6e 65 77 |{macroco|de}.\new|
|000050c0| 63 6f 75 6e 74 5c 63 61 | 6c 63 40 41 63 6f 75 6e |count\ca|lc@Acoun|
|000050d0| 74 20 20 20 5c 6e 65 77 | 63 6f 75 6e 74 5c 63 61 |t \new|count\ca|
|000050e0| 6c 63 40 42 63 6f 75 6e | 74 0a 5c 6e 65 77 64 69 |lc@Bcoun|t.\newdi|
|000050f0| 6d 65 6e 5c 63 61 6c 63 | 40 41 64 69 6d 65 6e 20 |men\calc|@Adimen |
|00005100| 20 20 5c 6e 65 77 64 69 | 6d 65 6e 5c 63 61 6c 63 | \newdi|men\calc|
|00005110| 40 42 64 69 6d 65 6e 0a | 5c 6e 65 77 73 6b 69 70 |@Bdimen.|\newskip|
|00005120| 5c 63 61 6c 63 40 41 73 | 6b 69 70 20 20 20 20 20 |\calc@As|kip |
|00005130| 5c 6e 65 77 73 6b 69 70 | 5c 63 61 6c 63 40 42 73 |\newskip|\calc@Bs|
|00005140| 6b 69 70 0a 25 20 20 20 | 20 5c 65 6e 64 7b 6d 61 |kip.% | \end{ma|
|00005150| 63 72 6f 63 6f 64 65 7d | 0a 25 0a 25 20 5c 73 75 |crocode}|.%.% \su|
|00005160| 62 73 65 63 74 69 6f 6e | 7b 54 68 65 20 5c 4c 61 |bsection|{The \La|
|00005170| 54 65 58 5c 20 69 6e 74 | 65 72 66 61 63 65 7d 0a |TeX\ int|erface}.|
|00005180| 25 0a 25 20 41 73 20 70 | 72 6f 6d 69 73 65 64 2c |%.% As p|romised,|
|00005190| 20 77 65 20 72 65 64 65 | 66 69 6e 65 20 74 68 65 | we rede|fine the|
|000051a0| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 73 74 61 6e 64 | followi|ng stand|
|000051b0| 61 72 64 20 5c 4c 61 54 | 65 58 5c 20 63 6f 6d 6d |ard \LaT|eX\ comm|
|000051c0| 61 6e 64 73 3a 0a 25 20 | 7c 5c 73 65 74 63 6f 75 |ands:.% ||\setcou|
|000051d0| 6e 74 65 72 7c 2c 20 0a | 25 20 7c 5c 61 64 64 74 |nter|, .|% |\addt|
|000051e0| 6f 63 6f 75 6e 74 65 72 | 7c 2c 20 7c 5c 73 65 74 |ocounter||, |\set|
|000051f0| 6c 65 6e 67 74 68 7c 2c | 20 61 6e 64 20 7c 5c 61 |length|,| and |\a|
|00005200| 64 64 74 6f 6c 65 6e 67 | 74 68 7c 2e 0a 25 20 20 |ddtoleng|th|..% |
|00005210| 20 20 5c 62 65 67 69 6e | 7b 6d 61 63 72 6f 63 6f | \begin|{macroco|
|00005220| 64 65 7d 0a 5c 64 65 66 | 5c 73 65 74 63 6f 75 6e |de}.\def|\setcoun|
|00005230| 74 65 72 23 31 23 32 7b | 5c 40 69 66 75 6e 64 65 |ter#1#2{|\@ifunde|
|00005240| 66 69 6e 65 64 7b 63 40 | 23 31 7d 7b 5c 40 6e 6f |fined{c@|#1}{\@no|
|00005250| 63 6f 75 6e 74 65 72 72 | 7b 23 31 7d 7d 25 0a 20 |counterr|{#1}}%. |
|00005260| 20 20 7b 5c 63 61 6c 63 | 40 61 73 73 69 67 6e 40 | {\calc|@assign@|
|00005270| 63 6f 75 6e 74 7b 5c 67 | 6c 6f 62 61 6c 5c 63 73 |count{\g|lobal\cs|
|00005280| 6e 61 6d 65 20 63 40 23 | 31 5c 65 6e 64 63 73 6e |name c@#|1\endcsn|
|00005290| 61 6d 65 7d 7b 23 32 7d | 7d 7d 0a 5c 64 65 66 5c |ame}{#2}|}}.\def\|
|000052a0| 61 64 64 74 6f 63 6f 75 | 6e 74 65 72 23 31 23 32 |addtocou|nter#1#2|
|000052b0| 7b 5c 40 69 66 75 6e 64 | 65 66 69 6e 65 64 7b 63 |{\@ifund|efined{c|
|000052c0| 40 23 31 7d 7b 5c 40 6e | 6f 63 6f 75 6e 74 65 72 |@#1}{\@n|ocounter|
|000052d0| 72 7b 23 31 7d 7d 25 0a | 20 20 20 7b 5c 63 61 6c |r{#1}}%.| {\cal|
|000052e0| 63 40 61 73 73 69 67 6e | 40 63 6f 75 6e 74 7b 5c |c@assign|@count{\|
|000052f0| 67 6c 6f 62 61 6c 5c 61 | 64 76 61 6e 63 65 5c 63 |global\a|dvance\c|
|00005300| 73 6e 61 6d 65 20 63 40 | 23 31 5c 65 6e 64 63 73 |sname c@|#1\endcs|
|00005310| 6e 61 6d 65 7d 7b 23 32 | 7d 7d 7d 0a 25 20 20 20 |name}{#2|}}}.% |
|00005320| 20 5c 65 6e 64 7b 6d 61 | 63 72 6f 63 6f 64 65 7d | \end{ma|crocode}|
|00005330| 0a 25 20 20 20 20 5c 62 | 65 67 69 6e 7b 6d 61 63 |.% \b|egin{mac|
|00005340| 72 6f 63 6f 64 65 7d 0a | 5c 44 65 63 6c 61 72 65 |rocode}.|\Declare|
|00005350| 52 6f 62 75 73 74 43 6f | 6d 6d 61 6e 64 5c 73 65 |RobustCo|mmand\se|
|00005360| 74 6c 65 6e 67 74 68 7b | 5c 63 61 6c 63 40 61 73 |tlength{|\calc@as|
|00005370| 73 69 67 6e 40 73 6b 69 | 70 7d 0a 5c 44 65 63 6c |sign@ski|p}.\Decl|
|00005380| 61 72 65 52 6f 62 75 73 | 74 43 6f 6d 6d 61 6e 64 |areRobus|tCommand|
|00005390| 5c 61 64 64 74 6f 6c 65 | 6e 67 74 68 5b 31 5d 7b |\addtole|ngth[1]{|
|000053a0| 5c 63 61 6c 63 40 61 73 | 73 69 67 6e 40 73 6b 69 |\calc@as|sign@ski|
|000053b0| 70 7b 5c 61 64 76 61 6e | 63 65 23 31 7d 7d 0a 25 |p{\advan|ce#1}}.%|
|000053c0| 20 20 20 20 5c 65 6e 64 | 7b 6d 61 63 72 6f 63 6f | \end|{macroco|
|000053d0| 64 65 7d 0a 25 20 28 7c | 5c 73 65 74 6c 65 6e 67 |de}.% (||\setleng|
|000053e0| 74 68 7c 20 61 6e 64 20 | 7c 5c 61 64 64 74 6f 6c |th| and ||\addtol|
|000053f0| 65 6e 67 74 68 7c 20 61 | 72 65 20 72 6f 62 75 73 |ength| a|re robus|
|00005400| 74 20 61 63 63 6f 72 64 | 69 6e 67 20 74 6f 0a 25 |t accord|ing to.%|
|00005410| 20 5c 63 69 74 65 7b 6c | 61 74 65 78 6d 61 6e 7d | \cite{l|atexman}|
|00005420| 2e 29 0a 25 0a 25 20 5c | 73 75 62 73 65 63 74 69 |.).%.% \|subsecti|
|00005430| 6f 6e 7b 54 68 65 20 73 | 63 61 6e 6e 65 72 7d 0a |on{The s|canner}.|
|00005440| 25 0a 25 20 57 65 20 65 | 76 61 6c 75 61 74 65 20 |%.% We e|valuate |
|00005450| 65 78 70 72 65 73 73 69 | 6f 6e 73 20 62 79 20 65 |expressi|ons by e|
|00005460| 78 70 6c 69 63 69 74 20 | 73 63 61 6e 6e 69 6e 67 |xplicit |scanning|
|00005470| 20 6f 66 20 63 68 61 72 | 61 63 74 65 72 73 2e 20 | of char|acters. |
|00005480| 20 57 65 20 64 6f 0a 25 | 20 6e 6f 74 20 72 65 6c | We do.%| not rel|
|00005490| 79 20 6f 6e 20 61 63 74 | 69 76 65 20 63 68 61 72 |y on act|ive char|
|000054a0| 61 63 74 65 72 73 20 66 | 6f 72 20 74 68 69 73 2e |acters f|or this.|
|000054b0| 0a 25 0a 25 20 54 68 65 | 20 73 63 61 6e 6e 65 72 |.%.% The| scanner|
|000054c0| 20 63 6f 6e 73 69 73 74 | 73 20 6f 66 20 74 77 6f | consist|s of two|
|000054d0| 20 70 61 72 74 73 2c 20 | 7c 5c 63 61 6c 63 40 70 | parts, ||\calc@p|
|000054e0| 72 65 40 73 63 61 6e 7c | 20 61 6e 64 0a 25 20 7c |re@scan|| and.% ||
|000054f0| 5c 63 61 6c 63 40 70 6f | 73 74 40 73 63 61 6e 7c |\calc@po|st@scan||
|00005500| 3b 20 7c 5c 63 61 6c 63 | 40 70 72 65 40 73 63 61 |; |\calc|@pre@sca|
|00005510| 6e 7c 20 63 6f 6e 73 75 | 6d 65 73 20 6c 65 66 74 |n| consu|mes left|
|00005520| 20 70 61 72 65 6e 74 68 | 65 73 65 73 2c 20 61 6e | parenth|eses, an|
|00005530| 64 0a 25 20 7c 5c 63 61 | 6c 63 40 70 6f 73 74 40 |d.% |\ca|lc@post@|
|00005540| 73 63 61 6e 7c 20 63 6f | 6e 73 75 6d 65 73 20 62 |scan| co|nsumes b|
|00005550| 69 6e 61 72 79 20 6f 70 | 65 72 61 74 6f 72 2c 20 |inary op|erator, |
|00005560| 7c 5c 72 65 61 6c 7c 2c | 20 7c 5c 72 61 74 69 6f ||\real|,| |\ratio|
|00005570| 7c 2c 20 61 6e 64 0a 25 | 20 72 69 67 68 74 20 70 ||, and.%| right p|
|00005580| 61 72 65 6e 74 68 65 73 | 69 73 20 74 6f 6b 65 6e |arenthes|is token|
|00005590| 73 2e 0a 25 20 5c 62 65 | 67 69 6e 7b 6d 61 63 72 |s..% \be|gin{macr|
|000055a0| 6f 7d 7b 5c 63 61 6c 63 | 40 70 72 65 40 73 63 61 |o}{\calc|@pre@sca|
|000055b0| 6e 7d 0a 25 20 7c 5c 63 | 61 6c 63 40 70 72 65 40 |n}.% |\c|alc@pre@|
|000055c0| 73 63 61 6e 7c 20 72 65 | 61 64 73 20 74 68 65 20 |scan| re|ads the |
|000055d0| 69 6e 69 74 69 61 6c 20 | 70 61 72 74 20 28 75 6e |initial |part (un|
|000055e0| 74 69 6c 20 73 6f 6d 65 | 20 5c 3c 6e 75 6d 65 72 |til some| \<numer|
|000055f0| 69 63 3e 20 69 73 20 73 | 65 65 6e 29 0a 25 20 6f |ic> is s|een).% o|
|00005600| 66 20 65 78 70 72 65 73 | 73 69 6f 6e 73 3b 20 6f |f expres|sions; o|
|00005610| 6e 6c 79 20 6c 65 66 74 | 20 70 61 72 65 6e 74 68 |nly left| parenth|
|00005620| 65 73 65 73 20 61 72 65 | 20 61 6c 6c 6f 77 65 64 |eses are| allowed|
|00005630| 20 68 65 72 65 2c 20 65 | 76 65 72 79 74 68 69 6e | here, e|verythin|
|00005640| 67 0a 25 20 65 6c 73 65 | 20 69 73 20 74 61 6b 65 |g.% else| is take|
|00005650| 6e 20 74 6f 20 62 65 20 | 61 20 5c 3c 6e 75 6d 65 |n to be |a \<nume|
|00005660| 72 69 63 3e 20 6f 66 20 | 73 6f 6d 65 20 73 6f 72 |ric> of |some sor|
|00005670| 74 3b 20 74 68 69 73 20 | 61 6c 6c 6f 77 73 20 75 |t; this |allows u|
|00005680| 6e 61 72 79 0a 25 20 60 | 5c 74 65 78 74 74 74 7b |nary.% `|\texttt{|
|00005690| 2b 7d 27 20 61 6e 64 20 | 75 6e 61 72 79 20 60 5c |+}' and |unary `\|
|000056a0| 74 65 78 74 74 74 7b 2d | 7d 27 20 74 6f 20 62 65 |texttt{-|}' to be|
|000056b0| 20 74 72 65 61 74 65 64 | 20 63 6f 72 72 65 63 74 | treated| correct|
|000056c0| 6c 79 2e 0a 25 20 20 20 | 20 5c 62 65 67 69 6e 7b |ly..% | \begin{|
|000056d0| 6d 61 63 72 6f 63 6f 64 | 65 7d 0a 5c 64 65 66 5c |macrocod|e}.\def\|
|000056e0| 63 61 6c 63 40 70 72 65 | 40 73 63 61 6e 23 31 7b |calc@pre|@scan#1{|
|000056f0| 25 0a 20 20 20 5c 69 66 | 78 28 23 31 25 0a 20 20 |%. \if|x(#1%. |
|00005700| 20 20 20 20 20 5c 6c 65 | 74 5c 63 61 6c 63 40 6e | \le|t\calc@n|
|00005710| 65 78 74 5c 63 61 6c 63 | 40 6f 70 65 6e 0a 20 20 |ext\calc|@open. |
|00005720| 20 5c 65 6c 73 65 0a 20 | 20 20 20 20 20 20 5c 6c | \else. | \l|
|00005730| 65 74 5c 63 61 6c 63 40 | 6e 65 78 74 5c 63 61 6c |et\calc@|next\cal|
|00005740| 63 40 6e 75 6d 65 72 69 | 63 0a 20 20 20 5c 66 69 |c@numeri|c. \fi|
|00005750| 0a 20 20 20 5c 63 61 6c | 63 40 6e 65 78 74 23 31 |. \cal|c@next#1|
|00005760| 7d 0a 25 20 20 20 20 5c | 65 6e 64 7b 6d 61 63 72 |}.% \|end{macr|
|00005770| 6f 63 6f 64 65 7d 0a 25 | 20 5c 65 6e 64 7b 6d 61 |ocode}.%| \end{ma|
|00005780| 63 72 6f 7d 0a 25 20 7c | 5c 63 61 6c 63 40 6f 70 |cro}.% ||\calc@op|
|00005790| 65 6e 7c 20 69 73 20 75 | 73 65 64 20 77 68 65 6e |en| is u|sed when|
|000057a0| 20 74 68 65 72 65 20 69 | 73 20 61 20 6c 65 66 74 | there i|s a left|
|000057b0| 20 70 61 72 65 6e 74 68 | 65 73 69 73 20 72 69 67 | parenth|esis rig|
|000057c0| 68 74 20 61 68 65 61 64 | 2e 0a 25 20 54 68 69 73 |ht ahead|..% This|
|000057d0| 20 70 61 72 65 6e 74 68 | 65 73 69 73 20 69 73 20 | parenth|esis is |
|000057e0| 72 65 70 6c 61 63 65 64 | 20 62 79 20 5c 54 65 58 |replaced| by \TeX|
|000057f0| 5c 20 63 6f 64 65 20 63 | 6f 72 72 65 73 70 6f 6e |\ code c|orrespon|
|00005800| 64 69 6e 67 20 74 6f 20 | 74 68 65 20 63 6f 64 65 |ding to |the code|
|00005810| 0a 25 20 73 65 71 75 65 | 6e 63 65 20 60 60 24 5c |.% seque|nce ``$\|
|00005820| 7b 5c 73 61 76 65 63 6f | 64 65 7b 42 5c 6c 61 73 |{\saveco|de{B\las|
|00005830| 73 69 67 6e 20 41 7d 5c | 7b 5c 73 61 76 65 63 6f |sign A}\|{\saveco|
|00005840| 64 65 7b 42 5c 6c 61 73 | 73 69 67 6e 20 41 7d 24 |de{B\las|sign A}$|
|00005850| 27 27 0a 25 20 64 65 72 | 69 76 65 64 20 69 6e 20 |''.% der|ived in |
|00005860| 53 65 63 74 69 6f 6e 7e | 5c 72 65 66 7b 65 76 61 |Section~|\ref{eva|
|00005870| 6c 75 61 74 69 6f 6e 3a | 73 63 68 65 6d 65 7d 2e |luation:|scheme}.|
|00005880| 20 20 46 69 6e 61 6c 6c | 79 2c 0a 25 20 7c 5c 63 | Finall|y,.% |\c|
|00005890| 61 6c 63 40 70 72 65 40 | 73 63 61 6e 7c 20 69 73 |alc@pre@|scan| is|
|000058a0| 20 0a 25 20 63 61 6c 6c | 65 64 20 61 67 61 69 6e | .% call|ed again|
|000058b0| 2e 0a 25 20 20 20 20 5c | 62 65 67 69 6e 7b 6d 61 |..% \|begin{ma|
|000058c0| 63 72 6f 63 6f 64 65 7d | 0a 5c 64 65 66 5c 63 61 |crocode}|.\def\ca|
|000058d0| 6c 63 40 6f 70 65 6e 28 | 7b 5c 62 65 67 69 6e 67 |lc@open(|{\beging|
|000058e0| 72 6f 75 70 5c 61 66 74 | 65 72 67 72 6f 75 70 5c |roup\aft|ergroup\|
|000058f0| 63 61 6c 63 40 69 6e 69 | 74 42 0a 20 20 20 5c 62 |calc@ini|tB. \b|
|00005900| 65 67 69 6e 67 72 6f 75 | 70 5c 61 66 74 65 72 67 |egingrou|p\afterg|
|00005910| 72 6f 75 70 5c 63 61 6c | 63 40 69 6e 69 74 42 0a |roup\cal|c@initB.|
|00005920| 20 20 20 5c 63 61 6c 63 | 40 70 72 65 40 73 63 61 | \calc|@pre@sca|
|00005930| 6e 7d 0a 5c 64 65 66 5c | 63 61 6c 63 40 69 6e 69 |n}.\def\|calc@ini|
|00005940| 74 42 7b 5c 63 61 6c 63 | 40 42 5c 63 61 6c 63 40 |tB{\calc|@B\calc@|
|00005950| 41 7d 0a 25 20 20 20 20 | 5c 65 6e 64 7b 6d 61 63 |A}.% |\end{mac|
|00005960| 72 6f 63 6f 64 65 7d 0a | 25 20 7c 5c 63 61 6c 63 |rocode}.|% |\calc|
|00005970| 40 6e 75 6d 65 72 69 63 | 7c 20 61 73 73 69 67 6e |@numeric|| assign|
|00005980| 73 20 74 68 65 20 66 6f | 6c 6c 6f 77 69 6e 67 20 |s the fo|llowing |
|00005990| 76 61 6c 75 65 20 74 6f | 20 7c 5c 63 61 6c 63 40 |value to| |\calc@|
|000059a0| 41 7c 20 61 6e 64 20 74 | 68 65 6e 0a 25 20 74 72 |A| and t|hen.% tr|
|000059b0| 61 6e 73 66 65 72 73 20 | 63 6f 6e 74 72 6f 6c 20 |ansfers |control |
|000059c0| 74 6f 20 7c 5c 63 61 6c | 63 40 70 6f 73 74 40 73 |to |\cal|c@post@s|
|000059d0| 63 61 6e 7c 2e 0a 25 20 | 20 20 20 5c 62 65 67 69 |can|..% | \begi|
|000059e0| 6e 7b 6d 61 63 72 6f 63 | 6f 64 65 7d 0a 5c 64 65 |n{macroc|ode}.\de|
|000059f0| 66 5c 63 61 6c 63 40 6e | 75 6d 65 72 69 63 7b 5c |f\calc@n|umeric{\|
|00005a00| 61 66 74 65 72 61 73 73 | 69 67 6e 6d 65 6e 74 5c |afterass|ignment\|
|00005a10| 63 61 6c 63 40 70 6f 73 | 74 40 73 63 61 6e 20 5c |calc@pos|t@scan \|
|00005a20| 67 6c 6f 62 61 6c 5c 63 | 61 6c 63 40 41 7d 0a 25 |global\c|alc@A}.%|
|00005a30| 20 20 20 20 5c 65 6e 64 | 7b 6d 61 63 72 6f 63 6f | \end|{macroco|
|00005a40| 64 65 7d 0a 25 0a 25 20 | 5c 62 65 67 69 6e 7b 6d |de}.%.% |\begin{m|
|00005a50| 61 63 72 6f 7d 7b 5c 63 | 61 6c 63 40 70 6f 73 74 |acro}{\c|alc@post|
|00005a60| 40 73 63 61 6e 7d 0a 25 | 20 54 68 65 20 6d 61 63 |@scan}.%| The mac|
|00005a70| 72 6f 20 7c 5c 63 61 6c | 63 40 70 6f 73 74 40 73 |ro |\cal|c@post@s|
|00005a80| 63 61 6e 7c 20 69 73 20 | 63 61 6c 6c 65 64 20 72 |can| is |called r|
|00005a90| 69 67 68 74 20 61 66 74 | 65 72 20 61 20 76 61 6c |ight aft|er a val|
|00005aa0| 75 65 20 68 61 73 20 62 | 65 65 6e 0a 25 20 72 65 |ue has b|een.% re|
|00005ab0| 61 64 2e 20 20 41 74 20 | 74 68 69 73 20 70 6f 69 |ad. At |this poi|
|00005ac0| 6e 74 2c 20 61 20 62 69 | 6e 61 72 79 20 6f 70 65 |nt, a bi|nary ope|
|00005ad0| 72 61 74 6f 72 2c 20 61 | 20 73 65 71 75 65 6e 63 |rator, a| sequenc|
|00005ae0| 65 20 6f 66 20 72 69 67 | 68 74 0a 25 20 70 61 72 |e of rig|ht.% par|
|00005af0| 65 6e 74 68 65 73 65 73 | 2c 20 61 6e 64 20 74 68 |entheses|, and th|
|00005b00| 65 20 65 6e 64 2d 6f 66 | 2d 65 78 70 72 65 73 73 |e end-of|-express|
|00005b10| 69 6f 6e 20 6d 61 72 6b | 20 28 60 7c 21 7c 27 29 |ion mark| (`|!|')|
|00005b20| 20 69 73 20 61 6c 6c 6f | 77 65 64 2e 0a 25 20 44 | is allo|wed..% D|
|00005b30| 65 70 65 6e 64 69 6e 67 | 20 6f 6e 20 6f 75 72 20 |epending| on our |
|00005b40| 66 69 6e 64 69 6e 67 73 | 2c 20 77 65 20 63 61 6c |findings|, we cal|
|00005b50| 6c 20 61 20 73 75 69 74 | 61 62 6c 65 20 6d 61 63 |l a suit|able mac|
|00005b60| 72 6f 20 74 6f 20 67 65 | 6e 65 72 61 74 65 20 74 |ro to ge|nerate t|
|00005b70| 68 65 0a 25 20 63 6f 72 | 72 65 73 70 6f 6e 64 69 |he.% cor|respondi|
|00005b80| 6e 67 20 5c 54 65 58 5c | 20 63 6f 64 65 20 28 65 |ng \TeX\| code (e|
|00005b90| 78 63 65 70 74 20 77 68 | 65 6e 20 77 65 20 64 65 |xcept wh|en we de|
|00005ba0| 74 65 63 74 20 74 68 65 | 0a 25 20 65 6e 64 2d 6f |tect the|.% end-o|
|00005bb0| 66 2d 65 78 70 72 65 73 | 73 69 6f 6e 20 6d 61 72 |f-expres|sion mar|
|00005bc0| 6b 65 72 3a 20 74 68 65 | 6e 20 73 63 61 6e 6e 69 |ker: the|n scanni|
|00005bd0| 6e 67 20 65 6e 64 73 2c | 20 61 6e 64 0a 25 20 63 |ng ends,| and.% c|
|00005be0| 6f 6e 74 72 6f 6c 20 69 | 73 20 72 65 74 75 72 6e |ontrol i|s return|
|00005bf0| 65 64 20 74 6f 20 7c 5c | 63 61 6c 63 40 61 73 73 |ed to |\|calc@ass|
|00005c00| 69 67 6e 40 67 65 6e 65 | 72 69 63 7c 29 2e 0a 25 |ign@gene|ric|)..%|
|00005c10| 20 0a 25 20 54 68 69 73 | 20 6d 61 63 72 6f 20 6d | .% This| macro m|
|00005c20| 61 79 20 62 65 20 6f 70 | 74 69 6d 69 7a 65 64 20 |ay be op|timized |
|00005c30| 62 79 20 73 65 6c 65 63 | 74 69 6e 67 20 61 20 64 |by selec|ting a d|
|00005c40| 69 66 66 65 72 65 6e 74 | 20 6f 72 64 65 72 20 6f |ifferent| order o|
|00005c50| 66 0a 25 20 7c 5c 69 66 | 78 7c 2d 74 65 73 74 73 |f.% |\if|x|-tests|
|00005c60| 2e 20 20 54 68 65 20 74 | 65 73 74 20 66 6f 72 20 |. The t|est for |
|00005c70| 60 5c 74 65 78 74 74 74 | 7b 21 7d 27 20 28 65 6e |`\texttt|{!}' (en|
|00005c80| 64 2d 6f 66 2d 65 78 70 | 72 65 73 73 69 6f 6e 29 |d-of-exp|ression)|
|00005c90| 20 69 73 0a 25 20 70 6c | 61 63 65 64 20 66 69 72 | is.% pl|aced fir|
|00005ca0| 73 74 20 61 73 20 69 74 | 20 77 69 6c 6c 20 61 6c |st as it| will al|
|00005cb0| 77 61 79 73 20 62 65 20 | 70 65 72 66 6f 72 6d 65 |ways be |performe|
|00005cc0| 64 3a 20 74 68 69 73 20 | 69 73 20 74 68 65 20 6f |d: this |is the o|
|00005cd0| 6e 6c 79 20 74 65 73 74 | 0a 25 20 74 6f 20 62 65 |nly test|.% to be|
|00005ce0| 20 70 65 72 66 6f 72 6d | 65 64 20 69 66 20 74 68 | perform|ed if th|
|00005cf0| 65 20 65 78 70 72 65 73 | 73 69 6f 6e 20 63 6f 6e |e expres|sion con|
|00005d00| 73 69 73 74 73 20 6f 66 | 20 61 20 73 69 6e 67 6c |sists of| a singl|
|00005d10| 65 20 5c 3c 6e 75 6d 65 | 72 69 63 3e 2e 0a 25 20 |e \<nume|ric>..% |
|00005d20| 54 68 69 73 20 65 6e 73 | 75 72 65 73 20 74 68 61 |This ens|ures tha|
|00005d30| 74 20 64 6f 63 75 6d 65 | 6e 74 73 20 74 68 61 74 |t docume|nts that|
|00005d40| 20 64 6f 20 6e 6f 74 20 | 75 73 65 20 74 68 65 20 | do not |use the |
|00005d50| 65 78 74 72 61 20 65 78 | 70 72 65 73 73 69 76 65 |extra ex|pressive|
|00005d60| 0a 25 20 70 6f 77 65 72 | 20 70 72 6f 76 69 64 65 |.% power| provide|
|00005d70| 64 20 62 79 20 74 68 65 | 20 5c 74 65 78 74 74 74 |d by the| \texttt|
|00005d80| 7b 63 61 6c 63 7d 20 70 | 61 63 6b 61 67 65 20 6f |{calc} p|ackage o|
|00005d90| 6e 6c 79 20 73 75 66 66 | 65 72 20 61 20 6d 69 6e |nly suff|er a min|
|00005da0| 69 6d 75 6d 0a 25 20 73 | 6c 6f 77 64 6f 77 6e 20 |imum.% s|lowdown |
|00005db0| 69 6e 20 70 72 6f 63 65 | 73 73 69 6e 67 20 74 69 |in proce|ssing ti|
|00005dc0| 6d 65 2e 0a 25 20 5c 65 | 6e 64 7b 6d 61 63 72 6f |me..% \e|nd{macro|
|00005dd0| 7d 0a 25 20 20 20 20 5c | 62 65 67 69 6e 7b 6d 61 |}.% \|begin{ma|
|00005de0| 63 72 6f 63 6f 64 65 7d | 0a 5c 64 65 66 5c 63 61 |crocode}|.\def\ca|
|00005df0| 6c 63 40 70 6f 73 74 40 | 73 63 61 6e 23 31 7b 25 |lc@post@|scan#1{%|
|00005e00| 0a 20 20 20 5c 69 66 78 | 23 31 21 5c 6c 65 74 5c |. \ifx|#1!\let\|
|00005e10| 63 61 6c 63 40 6e 65 78 | 74 5c 65 6e 64 67 72 6f |calc@nex|t\endgro|
|00005e20| 75 70 20 5c 65 6c 73 65 | 0a 20 20 20 20 5c 69 66 |up \else|. \if|
|00005e30| 78 23 31 2b 5c 6c 65 74 | 5c 63 61 6c 63 40 6e 65 |x#1+\let|\calc@ne|
|00005e40| 78 74 5c 63 61 6c 63 40 | 61 64 64 20 5c 65 6c 73 |xt\calc@|add \els|
|00005e50| 65 0a 20 20 20 20 20 5c | 69 66 78 23 31 2d 5c 6c |e. \|ifx#1-\l|
|00005e60| 65 74 5c 63 61 6c 63 40 | 6e 65 78 74 5c 63 61 6c |et\calc@|next\cal|
|00005e70| 63 40 73 75 62 74 72 61 | 63 74 20 5c 65 6c 73 65 |c@subtra|ct \else|
|00005e80| 0a 20 20 20 20 20 20 5c | 69 66 78 23 31 2a 5c 6c |. \|ifx#1*\l|
|00005e90| 65 74 5c 63 61 6c 63 40 | 6e 65 78 74 5c 63 61 6c |et\calc@|next\cal|
|00005ea0| 63 40 6d 75 6c 74 69 70 | 6c 79 78 20 5c 65 6c 73 |c@multip|lyx \els|
|00005eb0| 65 0a 20 20 20 20 20 20 | 20 5c 69 66 78 23 31 2f |e. | \ifx#1/|
|00005ec0| 5c 6c 65 74 5c 63 61 6c | 63 40 6e 65 78 74 5c 63 |\let\cal|c@next\c|
|00005ed0| 61 6c 63 40 64 69 76 69 | 64 65 78 20 5c 65 6c 73 |alc@divi|dex \els|
|00005ee0| 65 0a 20 20 20 20 20 20 | 20 20 5c 69 66 78 23 31 |e. | \ifx#1|
|00005ef0| 29 5c 6c 65 74 5c 63 61 | 6c 63 40 6e 65 78 74 5c |)\let\ca|lc@next\|
|00005f00| 63 61 6c 63 40 63 6c 6f | 73 65 20 5c 65 6c 73 65 |calc@clo|se \else|
|00005f10| 20 5c 63 61 6c 63 40 65 | 72 72 6f 72 23 31 25 0a | \calc@e|rror#1%.|
|00005f20| 20 20 20 20 20 20 20 20 | 5c 66 69 0a 20 20 20 20 | |\fi. |
|00005f30| 20 20 20 5c 66 69 0a 20 | 20 20 20 20 20 5c 66 69 | \fi. | \fi|
|00005f40| 0a 20 20 20 20 20 5c 66 | 69 0a 20 20 20 20 5c 66 |. \f|i. \f|
|00005f50| 69 0a 20 20 20 5c 66 69 | 0a 20 20 20 5c 63 61 6c |i. \fi|. \cal|
|00005f60| 63 40 6e 65 78 74 7d 0a | 25 20 20 20 20 5c 65 6e |c@next}.|% \en|
|00005f70| 64 7b 6d 61 63 72 6f 63 | 6f 64 65 7d 0a 25 0a 25 |d{macroc|ode}.%.%|
|00005f80| 20 54 68 65 20 72 65 70 | 6c 61 63 65 6d 65 6e 74 | The rep|lacement|
|00005f90| 20 63 6f 64 65 20 66 6f | 72 20 74 68 65 20 62 69 | code fo|r the bi|
|00005fa0| 6e 61 72 79 20 6f 70 65 | 72 61 74 6f 72 73 20 60 |nary ope|rators `|
|00005fb0| 5c 74 65 78 74 74 74 7b | 2b 7d 27 20 61 6e 64 0a |\texttt{|+}' and.|
|00005fc0| 25 20 60 5c 74 65 78 74 | 74 74 7b 2d 7d 27 20 66 |% `\text|tt{-}' f|
|00005fd0| 6f 6c 6c 6f 77 20 61 20 | 63 6f 6d 6d 6f 6e 20 70 |ollow a |common p|
|00005fe0| 61 74 74 65 72 6e 3b 20 | 74 68 65 20 6f 6e 6c 79 |attern; |the only|
|00005ff0| 20 64 69 66 66 65 72 65 | 6e 63 65 20 69 73 20 74 | differe|nce is t|
|00006000| 68 65 0a 25 20 74 6f 6b | 65 6e 20 74 68 61 74 20 |he.% tok|en that |
|00006010| 69 73 20 73 74 6f 72 65 | 64 20 61 77 61 79 20 62 |is store|d away b|
|00006020| 79 20 7c 5c 61 66 74 65 | 72 67 72 6f 75 70 7c 2e |y |\afte|rgroup|.|
|00006030| 20 20 41 66 74 65 72 20 | 74 68 69 73 20 72 65 70 | After |this rep|
|00006040| 6c 61 63 65 6d 65 6e 74 | 0a 25 20 63 6f 64 65 2c |lacement|.% code,|
|00006050| 20 63 6f 6e 74 72 6f 6c | 20 69 73 20 74 72 61 6e | control| is tran|
|00006060| 73 66 65 72 72 65 64 20 | 74 6f 20 7c 5c 63 61 6c |sferred |to |\cal|
|00006070| 63 40 70 72 65 40 73 63 | 61 6e 7c 2e 0a 25 20 20 |c@pre@sc|an|..% |
|00006080| 20 20 5c 62 65 67 69 6e | 7b 6d 61 63 72 6f 63 6f | \begin|{macroco|
|00006090| 64 65 7d 0a 5c 64 65 66 | 5c 63 61 6c 63 40 61 64 |de}.\def|\calc@ad|
|000060a0| 64 7b 5c 63 61 6c 63 40 | 67 65 6e 65 72 69 63 40 |d{\calc@|generic@|
|000060b0| 61 64 64 5c 63 61 6c 63 | 40 61 64 64 41 74 6f 42 |add\calc|@addAtoB|
|000060c0| 7d 0a 5c 64 65 66 5c 63 | 61 6c 63 40 73 75 62 74 |}.\def\c|alc@subt|
|000060d0| 72 61 63 74 7b 5c 63 61 | 6c 63 40 67 65 6e 65 72 |ract{\ca|lc@gener|
|000060e0| 69 63 40 61 64 64 5c 63 | 61 6c 63 40 73 75 62 74 |ic@add\c|alc@subt|
|000060f0| 72 61 63 74 41 66 72 6f | 6d 42 7d 0a 5c 64 65 66 |ractAfro|mB}.\def|
|00006100| 5c 63 61 6c 63 40 67 65 | 6e 65 72 69 63 40 61 64 |\calc@ge|neric@ad|
|00006110| 64 23 31 7b 5c 65 6e 64 | 67 72 6f 75 70 5c 67 6c |d#1{\end|group\gl|
|00006120| 6f 62 61 6c 5c 63 61 6c | 63 40 41 5c 63 61 6c 63 |obal\cal|c@A\calc|
|00006130| 40 42 5c 65 6e 64 67 72 | 6f 75 70 0a 20 20 20 5c |@B\endgr|oup. \|
|00006140| 62 65 67 69 6e 67 72 6f | 75 70 5c 61 66 74 65 72 |begingro|up\after|
|00006150| 67 72 6f 75 70 23 31 5c | 62 65 67 69 6e 67 72 6f |group#1\|begingro|
|00006160| 75 70 5c 61 66 74 65 72 | 67 72 6f 75 70 5c 63 61 |up\after|group\ca|
|00006170| 6c 63 40 69 6e 69 74 42 | 0a 20 20 20 5c 63 61 6c |lc@initB|. \cal|
|00006180| 63 40 70 72 65 40 73 63 | 61 6e 7d 0a 5c 64 65 66 |c@pre@sc|an}.\def|
|00006190| 5c 63 61 6c 63 40 61 64 | 64 41 74 6f 42 7b 5c 61 |\calc@ad|dAtoB{\a|
|000061a0| 64 76 61 6e 63 65 5c 63 | 61 6c 63 40 42 5c 63 61 |dvance\c|alc@B\ca|
|000061b0| 6c 63 40 41 7d 0a 5c 64 | 65 66 5c 63 61 6c 63 40 |lc@A}.\d|ef\calc@|
|000061c0| 73 75 62 74 72 61 63 74 | 41 66 72 6f 6d 42 7b 5c |subtract|AfromB{\|
|000061d0| 61 64 76 61 6e 63 65 5c | 63 61 6c 63 40 42 2d 5c |advance\|calc@B-\|
|000061e0| 63 61 6c 63 40 41 7d 0a | 25 20 20 20 20 5c 65 6e |calc@A}.|% \en|
|000061f0| 64 7b 6d 61 63 72 6f 63 | 6f 64 65 7d 0a 25 0a 25 |d{macroc|ode}.%.%|
|00006200| 20 54 68 65 20 6d 75 6c | 74 69 70 6c 69 63 61 74 | The mul|tiplicat|
|00006210| 69 76 65 20 6f 70 65 72 | 61 74 6f 72 73 2c 20 60 |ive oper|ators, `|
|00006220| 5c 74 65 78 74 74 74 7b | 2a 7d 27 20 61 6e 64 20 |\texttt{|*}' and |
|00006230| 60 5c 74 65 78 74 74 74 | 7b 2f 7d 27 2c 20 6d 61 |`\texttt|{/}', ma|
|00006240| 79 20 62 65 0a 25 20 66 | 6f 6c 6c 6f 77 65 64 20 |y be.% f|ollowed |
|00006250| 62 79 20 61 20 7c 5c 72 | 65 61 6c 7c 20 6f 72 20 |by a |\r|eal| or |
|00006260| 61 20 7c 5c 72 61 74 69 | 6f 7c 20 74 6f 6b 65 6e |a |\rati|o| token|
|00006270| 2e 20 20 54 68 6f 73 65 | 20 63 6f 6e 74 72 6f 6c |. Those| control|
|00006280| 20 73 65 71 75 65 6e 63 | 65 73 0a 25 20 61 72 65 | sequenc|es.% are|
|00006290| 20 6e 6f 74 20 64 65 66 | 69 6e 65 64 20 28 61 74 | not def|ined (at|
|000062a0| 20 6c 65 61 73 74 20 6e | 6f 74 20 62 79 20 74 68 | least n|ot by th|
|000062b0| 65 20 5c 74 65 78 74 74 | 74 7b 63 61 6c 63 7d 20 |e \textt|t{calc} |
|000062c0| 70 61 63 6b 61 67 65 29 | 2e 0a 25 20 20 20 20 5c |package)|..% \|
|000062d0| 62 65 67 69 6e 7b 6d 61 | 63 72 6f 63 6f 64 65 7d |begin{ma|crocode}|
|000062e0| 0a 5c 64 65 66 5c 63 61 | 6c 63 40 6d 75 6c 74 69 |.\def\ca|lc@multi|
|000062f0| 70 6c 79 78 23 31 7b 5c | 64 65 66 5c 63 61 6c 63 |plyx#1{\|def\calc|
|00006300| 40 74 6d 70 7b 23 31 7d | 25 0a 20 20 20 5c 69 66 |@tmp{#1}|%. \if|
|00006310| 78 5c 63 61 6c 63 40 74 | 6d 70 5c 63 61 6c 63 40 |x\calc@t|mp\calc@|
|00006320| 72 61 74 69 6f 40 78 20 | 5c 6c 65 74 5c 63 61 6c |ratio@x |\let\cal|
|00006330| 63 40 6e 65 78 74 5c 63 | 61 6c 63 40 72 61 74 69 |c@next\c|alc@rati|
|00006340| 6f 40 6d 75 6c 74 69 70 | 6c 79 20 5c 65 6c 73 65 |o@multip|ly \else|
|00006350| 0a 20 20 20 20 20 20 5c | 69 66 78 5c 63 61 6c 63 |. \|ifx\calc|
|00006360| 40 74 6d 70 5c 63 61 6c | 63 40 72 65 61 6c 40 78 |@tmp\cal|c@real@x|
|00006370| 20 5c 6c 65 74 5c 63 61 | 6c 63 40 6e 65 78 74 5c | \let\ca|lc@next\|
|00006380| 63 61 6c 63 40 72 65 61 | 6c 40 6d 75 6c 74 69 70 |calc@rea|l@multip|
|00006390| 6c 79 20 5c 65 6c 73 65 | 0a 20 20 20 20 20 20 20 |ly \else|. |
|000063a0| 20 20 5c 6c 65 74 5c 63 | 61 6c 63 40 6e 65 78 74 | \let\c|alc@next|
|000063b0| 5c 63 61 6c 63 40 6d 75 | 6c 74 69 70 6c 79 0a 20 |\calc@mu|ltiply. |
|000063c0| 20 20 20 20 20 5c 66 69 | 0a 20 20 20 5c 66 69 0a | \fi|. \fi.|
|000063d0| 20 20 20 5c 63 61 6c 63 | 40 6e 65 78 74 23 31 7d | \calc|@next#1}|
|000063e0| 0a 5c 64 65 66 5c 63 61 | 6c 63 40 64 69 76 69 64 |.\def\ca|lc@divid|
|000063f0| 65 78 23 31 7b 5c 64 65 | 66 5c 63 61 6c 63 40 74 |ex#1{\de|f\calc@t|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.